Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

There are 2 versions. Label each .java file with basic and intermediate.For this assignment there are two versions of the java script files I'll need. Each one builds off the previous starting with...

1 answer below »
Inventory Intermediate version
If you complete this version co
ectly, you will receive up to a 89% (B)
Complete (and submit) the basic version first. Then, create a new version adding the following to basic version:
The input file will have 2 new items at the end of each line:
sold – The number of these items sold in past month
minimum – the level of inventory at which the item should be restocked (buy more from your vendor)
Output this new data in columns in the output file, along with new columns called “profit” and “left”
Write a method to determine profit, sending the method the values of cost, price, and sold. It should return the amount of profit made.
The “left” column should be the (quantity – sold), that is the number of items left in inventory.
Create a new output file named “reorder.txt”. It will have listed the items whose left amount is <= the target amount. Include the name, quantity, sold, target
and left amounts. It, too, should be formatted in tabular form with a title row.
Summary data should also include total profit and # of items to be reordered.
Sample input file:
thingy XXXXXXXXXX
Whatchacallit XXXXXXXXXX
gizmo XXXXXXXXXX
Should produce an output file:
XXXXXXXXXXItem Quantity Cost (W) Markup % Price(R) Value (W) Value (R) Sold Target profit Left
--------------------------------------------------------------------------------------------------------------------
XXXXXXXXXXthingy XXXXXXXXXX XXXXXXXXXX XXXXXXXXXX XXXXXXXXXX XXXXXXXXXX
Whatchacallit XXXXXXXXXX XXXXXXXXXX XXXXXXXXXX XXXXXXXXXX XXXXXXXXXX
XXXXXXXXXXgizmo XXXXXXXXXX XXXXXXXXXX XXXXXXXXXX XXXXXXXXXX XXXXXXXXXX

And a reorder file:
XXXXXXXXXXItem Quantity Sold Target Left
-----------------------------------------------------
Whatchacallit XXXXXXXXXX XXXXXXXXXX
XXXXXXXXXXgizmo XXXXXXXXXX XXXXXXXXXX

And summary data:
Total value of all items:
Wholesale: $5355.71
Retail: $6933.55
# of different items: 3
Total # of items: 91
Total Profit: $743.15
# of items needing reorder: 2
Answered Same Day Dec 05, 2021

Solution

Arun Shankar answered on Dec 09 2021
138 Votes
import java.io.File;
import java.io.FileWriter;
import java.util.Scanner;
public class Basic
{
    
    public static double round_off(double arg)
    {
        arg *= 100;
        arg = (int) Math.ceil(arg);
        return arg/100;
    }
    
    public static void main(String[] args)
    {
        try
        {
            int qty=0, count=0, num_items=0;
            double cost=0, markup=0, price=0, value_w=0, value_r=0;
            
            double sum_valuew=0, sum_valuer=0;
            
            Scanner scanner = new Scanner(new File("src/input.txt"));
            FileWriter fw = new FileWriter("src/testout.txt");
            
            
Write header in the output file
            fw.write("Item\tQuantity\tCost (W)\tMarkup %\tPrice(R)\tValue (W)\tValue...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here