Question: Question 3 (10 points) Write a program that reads from the standard input an inventory file using the following format: Product ID price per unit


Question 3 (10 points) Write a program that reads from the standard input an inventory file using the following format: Product ID price per unit Number of units available The file starts with an integer to indicate the number of records, followed by records each record in a separate line The first two fields are in every record. The third field if 0 it is not there at all, for example AC 1234 KO1234 BB9876 132.25 412.67 305.00 12 That means the second product has 0 units Your program calculates the total inventory value and display it as a left justified floating point number with two decimal digits (%.2f note there is a decimal point before the 2) followed by a new line character. Constraints: . ID is a 6-character string . The maximum number of records in the file is 30
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
