Program specification for Homework 3, Part 2 solution

$19.99

Original Work ?
Category:

Description

5/5 - (1 vote)

Program specification for Homework 3, Part 2.

MP Mail Order House sells five products.  Product numbers, unit prices, and current inventory levels, are as follows:

Product No
Unit Price
Current Inventory Level
1
$2.98
10
2
$4.50
8
3
$9.98
15
4
$4.49
3
5
$6.87
0
I. Write the class  MailOrder to provide the following functions:

Set up one one-dimensional array for each field: product number (integer), unit price (double), and current inventory level (integer) in main memory to hold the above product information. There should be five rows (0 to 4) in each array, one for each item. For example, row 0 of the array for the product number is to hold the product number of product 1. Row 0 of the array for the unit price is to hold the unit price of product 1.  Row 0 of the array for the current inventory level is to hold the current inventory level of product 1, etc.

 The system should accept incoming sales orders until the user chooses to quit.  In each sales order, a user can buy more than one item.  For each item, the system accepts the product number and the quantity to be purchased.  The system retrieves the correct unit price and current inventory level for that particular item.  The system only sells up to the current inventory available.  If the system can sell x pieces of this item in this order, the system calculates and displays the total amount for this item and also decreases the item inventory level by x immediately.  When the user has finished keying in all the items of an order, the system displays the order total amount. 

When the user says there are no more orders, the system displays the daily sales total. This is the total sales amount of all the orders processed.  Then the system should end the execution of the system.

Detailed description of how the system should work is as follows:

When the system is run: 

Display the following main question:

Please enter the next action ( a new order and ):