Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is a java lab assignment. I have added the first part java retail class at the bottom. I am unsure how to read the

This is a java lab assignment. I have added the first part "java retail class" at the bottom. I am unsure how to read the txt file into an array from the retail class. The stock txt file has been added also.

A beginning framework and inventory list has been provided to you to use your Retail Item Class as an array. Develop a program to accomplish the following menu items that can be selected by the end user. Discussion of what each menu item should do is provided below the menu item. Modify your object class file as desired. Please append initials to files created. Use Select-Case for menu choices and methods to perform those choices. Please make a selection: 1. Open Inventory File (This should ask the user for the file name, open the file and load the data into the object array). 2. Display All (This should show a table of all items and data) 3. Display Reorder Only (This should show only the stock number, Description and current quantity for items requiring reorder) 4. Find Stock number (Allows the user to enter part of the description and displays all matching stock numbers and descriptions matching that - case insensitive, such as cubs or cubs) 5. Display Stock number (Allows user to enter stock number and displays record of item) 6. Add Quantity (Asks for stock number and quantity for units, adds it to current, displays record results) 7. Subtract Quantity (Asks for stock number and quantity, subtracts, displays results including if reorder is needed.) 8. Change Price (Asks for stick number, changes price to provided value, display results). 9. New Item (Allows adding a new item, updates count. Display record results). 10. Save Inventory File (asks user for file name, save all inventory to that file in a format that can be read back.)

public class RetailItem{ private String description; private int unitsOnHand; private double price; private int restock; public void setDescription(String userDescription){ description=userDescription; } public void setUnitsOnHand(int userUnitsOnHand){ unitsOnHand=userUnitsOnHand; } public void setPrice(double userPrice){ price=userPrice; } public String getDescription(){ return description; } public int getUnitsOnHand(){ return unitsOnHand; } public double getPrice(){ return price; } public double getTotal(){ int total = unitsOnHand=(int) price; return total; } public boolean getRestock(){ return false; } public RetailItem(String descriptionGiven, int unitsOnHandGiven, double priceGiven, int restockGiven){ description=descriptionGiven; unitsOnHand=unitsOnHandGiven; price=priceGiven; restock=restockGiven; } }

10001 Blue Jeans, 32x30 12 29.50 5 10002 Pink Floyd T-Shirt, Large 3 12.95 5 10003 Cardinals Watch 10 49.49 3 10009 Cubs ballcap 25 12.95 10 10012 Men's belt, 40 inch 2 8.95 5 10015 Cubs T-shirt, Large 3 14.95 10 10016 Patriots ballcap 5 19.95 5 10017 Cubs Koozie 10 4.95 5 

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Graph Databases

Authors: Ian Robinson, Jim Webber, Emil Eifrem

1st Edition

1449356265, 978-1449356262

More Books

Students also viewed these Databases questions