Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 2 ( 2 0 Points ) Write a Java program that asks the user to input the number of new inventories he bought. Your

Question 2(20 Points)
Write a Java program that asks the user to input the number of new inventories he bought. Your program should then ask user to input the details for each inventory: inventory's name (String), number of new units (int) and the unit price (double) for buying new inventory unit and store them into three parallel arrays. Your program should:
(a) Calculate and display the total cost for all inventories. Total cost can be calculated as follows:
Total Cost for ALL = SUM OF ALL (number of units x unit price)
(b) Display the inventory's name, number of new units, unit price and cost for each inventory. The cost can be calculated as follows:
Cost for each inventory = number of units x unit price
The output of the program should look like the following sample:
SAMPLE INPUT/OUTPUT
Enter number of new inventories: 4
Enter 4 inventory details (name, units, price):
Desk 3125.5
Table 275.5
Chair 639.55
Fridge 2236.4
Total cost for all inventories = BD 1237.6
Name New Units Unit Price Cost
Desk 3,125.5,376.5
Table 2,75.5,151.0
Chair 6,39.55,237.299999999
Fridge 2,236.4,472.8
image text in transcribed

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

Question

Do you have a family? Do you intend to have a family?

Answered: 1 week ago

Question

Discuss the history of human resource management (HRM).

Answered: 1 week ago