Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a program in Java to keep track of a hardware store\'s inventory. The stor

ID: 3640213 • Letter: W

Question

Write a program in Java to keep track of a hardware store's inventory. The store sales various items. For each item in the store, the following information is kept: item ID, item name, number of pieces sold, manufacturer's price of the item, and the store's selling price. At the end of each week, the store manager would like to see a report in the following form:

Inputfile
----------------------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 items currently in the store. The total number of items in the sum of the number of pieces of all the items in the store. The total number of items is the sum of the number of pieces of all 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

Use seven parallel vectors to store the information. The program must contain at least the following methods--a method to input data into the vectors, a method to display the menu, a method to sell an item, and a method to print the report for the manager. After inputting the data, sort it according to the items' names.

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; index
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote