Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A8YourName.java. Write a program to manage an inventory. Create a Product class Each product in the inventory contains a product name, an amount in stock,

image text in transcribedimage text in transcribed

A8YourName.java. Write a program to manage an inventory. Create a Product class Each product in the inventory contains a product name, an amount in stock, and a unit price. Provide default and parameterized constructors, accessor, and modifier functions. Input: The data should be read from a file and stored in an array of Product. Assume product names do not contain blanks. Size the initial array to 50 elements; code may assume no more than 50 products will be inserted as the program runs. File inventory.txt on Blackboard contains the initial data. This program will study the unordered array algorithms of sequential search, insert, and remove. Processing: Use a loop to present a simple menu of choices to the user. a) Edit the amount in stock of a product. If the item is found, report the name and the new amount in stock. If it is not found, report the name and a message that the item was not found b) Insert a new product with initial amount of stock and unit price. Report the name with a message it was successfully inserted. If the name already exists, report the name and a message that the item could not be inserted. c) Remove a product. If the removal is successful, report the name and a message that the item was successfully removed. If the item is not found in the array, report the name and a message that the item could not be removed. d) Display the inventory, listing each product's name, number in stock, and unit price on separate lines using field widths to create a neat table. Under the table display the total worth of the inventory, computed as the sum of each product's amount in stock times its unit price. Turn in Product.java and A8YourName.java and the output on the sample processing shown below. Your name displays on the top line. The output statements must clearly demonstrate the tasks requested. See sample output. 947 words

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

More Books

Students also viewed these Databases questions