Write a program to keep track of a hardware store\'s inventory. The store sell v
ID: 3640593 • Letter: W
Question
Write a program to keep track of a hardware store's inventory. The store sell various items. For each item in the store the following information is kept: item ID, item name, number of pieces ordered, number of pieces currently in the store, number of pieces sold, manufacturer's price for the item, and the stores selling price. At the end of each week the store manager wants to see a report in the following form:Friendly Hardware Store
itemID itemName pOrdered pInStore pSold manufPrice sellingPrice
1111 Circular Saw 150 110 40 45.00 125.00
2222 Cooking Range 50 30 20 450.00 850.00
.
.
.
Total Inventory: $#########.##
Total number of items in the store:_________
The total inventory is the total selling value of all the tiems currently in the store. The total number of items is the sum of the number of pieces of all the items in the store.
Your program must be menu driven, giving the user various choices such as: Check whether an item is in the store, sell an item, and print the report. After inputting the data, sort it according to the items; names. also, after an item is sold, update the appropriate counts.
Initially, the number of pieces (of an item) in the store is the same as the number of pieces ordered, and the number of pieces of an item sold is zero. Input to the program is a file consisting of data in the following form:
itemID
itemName
pOrdered manufPrice sellingPrice
after inputting data, sort it according to the items names.
the program should read from file.
i did some work but throwing many errors
import java.io.*;
import java.util.Scanner;
import java.util.Vector;
public class trial {
/**
* @param args
*/
public static void main(String[] args) throws FileNotFoundException {
int[]ItemIdList = new int[10];
String[]ItemNameList = new String[10];
int[]POrderList = new int[10];
int[]InStoreList = new int[10];
int[]PSldList = new int[10];
Double[]ManufacturePrice = new Double[10];
Double[]RetailPrice = new Double[10];
Scanner inFile = new Scanner(new FileReader("Inventory.txt"));
inputData(inFile, ItemIdList, ItemNameList,POrderList, InStoreList, PSldList, ManufacturePrice, RetailPrice);
sortData(ItemIdList, ItemNameList, POrderList, InStoreList, PSldList, ManufacturePrice, RetailPrice);
printMenu();
printRpt();
public static inputData(Scanner input, Vector<Integer> inpID, Vector<String> inpName, Vector<Integer> inpOrdered, Vector<Integer> inpInStore,Vector<Integer> inpSold, Vector<Double> inpManPrice, Vector<Double> inpSellPrice);
{
int id;
String name;
int order;
double price, sellPrice;
while (input.hasNext());
{
id = input.nextInt();
name = input.nextLine();
order = input.nextInt();
price = input.nextDouble();
sellPrice = input.nextDouble();
inpID.addElement(new Integer(id));
inpName.addElement(name);
inpOrdered.addElement(new Integer(order));
inpInStore.addElement(new Integer(order));
inpSold.addElement(new Integer(0));
inpManPrice.addElement(new Double(price));
inpSellPrice.addElement(new Double(sellPrice));
}
}
public static void printMenu();
{
int number;
int index;
System.out.println("Welcome to Friendly's Hardware Store");
System.out.println("To Check Avaliable items and quantity, Press 1");
number = console.nextint();
if (number = 2);
for (index = 0; index<inpName.length;index++);
System.out.print(" Here is Current Listing of Items :" +inpName[index]);
else
System.out.println();
System.out.println("To Sell an Item, Press 3");
System.out.println("To Print Report, Press 4");
}
public static void sellItem()
{
int item;
string name;
int sold;
int store;
System.out.println("Enter item Number: ");
int item= console.nextInt();
System.out.println("Enter the Item Name: ");
String name = console.next();
System.out.println("Enter Quantity sold: ");
int sold = console.nextint();
public int indexOf(Object item)
}
public static void printRpt()
{
int[]itemID;
String[]itemName;
int[]POrdered;
int[]pinStore;
int[]pSold;
int i,j;
double ManufacturePrice, sellingPrice;
int totalitems = 0;
int totinstore = 0;
system.out.println("..................Friendly Hardware Store"+ ".................../n");
System.out.println("ItemID" + "ItemName " + "pOrdered" + " pinStore" + "pSold" + "ManufacturePrice" + "SellingPrice");" +
system.out.printf(itemID[], ItemName[], pOrdered[], pinStore[], pSold[], ManufacturePrice[], sellingPrice[]);
for (i=O; i<pSold.length; i++);
totitems = totitems + pSold[i];
System.out.println("Total Number of Items in the Store " + totinstoe);
}
}
private static void printRpt() {
// TODO Auto-generated method stub
}
private static void printMenu() {
// TODO Auto-generated method stub
}
private static void sortData(int[] itemIdList, String[] itemNameList,
int[] pOrderList, int[] inStoreList, int[] pSldList,
Double[] manufacturePrice, Double[] retailPrice) {
// TODO Auto-generated method stub
}
private static void inputData(Scanner inFile, int[] itemIdList,
String[] itemNameList, int[] pOrderList, int[] inStoreList,
int[] pSldList, Double[] manufacturePrice, Double[] retailPrice) {
// TODO Auto-generated method stub
}
}
Explanation / Answer
import java.io.*; 002 import java.util.*; 003 004 public class HardwareStore 005 { 006 public static void main(String[] args) throws FileNotFoundException 007 { 008 int[]ItemIdList = new int[10]; 009 String[]ItmNmeList = new String[10]; 010 int[]PordrList = new int[10]; 011 int[]InStreList = new int[10]; 012 int[]PSldList = new int[10]; 013 Double[]ManuPrceList = new Double[10]; 014 Double[]SelPrceList = new Double[10]; 015 016 Scanner inFile = new Scanner(new FileReader("e:\Data.txt")); 017 018 inputData(inFile, ItmIdList, ItmNmeList, PordrList, InStreList, PSldList, ManuPrceList, SelPrceList); 019 020 sortData(ItmIdList, ItmNmeList, PordrList, InStreList, PSldList, ManuPrceList, SelPrceList); 021 022 printMenu(); 023 printRpt(); 024 025 public static inputData(Scanner input, Vector inpID, Vector inpName, 026 Vector inpOrdered, Vector inpInStore, 027 Vector inpSold, Vector inpManPrice, 028 Vector inpSellPrice) 029 { 030 int id; 031 String name; 032 int order; 033 double price, sellPrice; 034 035 while (input.hasNext()); 036 { 037 id = input.nextInt(); 038 name = input.nextLine(); 039 order = input.nextInt(); 040 price = input.nextDouble(); 041 sellPrice = input.nextDouble(); 042 043 inpID.addElement(new Integer(id)); 044 inpName.addElement(name); 045 inpOrdered.addElement(new Integer(order)); 046 inpInStore.addElement(new Integer(order)); 047 inpSold.addElement(new Integer(0)); 048 inpManPrice.addElement(new Double(price)); 049 inpSellPrice.addElement(new Double(sellPrice)); 050 } 051 } 052 public static void printMenu() 053 { 054 int number; 055 int index; 056 057 System.out.println("Welcome to the Friendly Hardware Store"); 058 System.out.println("To view our available items and their quantity, press 1"); 059 060 number = console.nextint(); 061 062 if (number = 2) 063 for (index=0; indexRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.