Specification:
You work for Trinkets Inc. They have a mail order business and you are to write a program that displays on the screen a customer's invoice. The program begins by loading into an array of instances of the structure: inventory, the inventory contained in the file:inventory.txt. This file consists of records each with the fields: item number, item name and unit price. There are at most 200 items in the inventory at any one time.
The structure: inventory with the data members: itemNumber, itemName and unitPrice that are a long, a string and a double respectively could be used to store the inventory data.
For each invoice, the user enters the customer name and address. The program then requests the item number of the item requested. If the item is not in the inventory, then an error message appears on the screen and continues to the next item. If the item exists, then the user enters the number of that item ordered. As each item is entered, the item is added to an array of objects of the structure items.
The structure: items with the two data members: itemOrdered and numberOrdered could be used to store an invoice item. In this case, the itemOrdered is an instance of the structure inventory and the numberOrdered is an int.
The invoice can consist of at most 10 items. After each item is entered, the program asks the user whether there is to be another item. If there is, then the new item is entered. If not or if 10 items have been entered, then the data entry ends and the invoice is displayed.
The invoice displays the customer name and address; a line for each item ordered that includes item number, the name, number ordered, price per unit and total for that part all on a line. The invoice ends with a total amount of money for the items ordered. All of the data appearing in the invoice should be formatted for the type of data appearing.
After each invoice has been displayed, the user has the option to enter another invoice. There are to be no global variables and the program is to be based on modular design. The program is to be written in C++ and called: invoices.cpp.
Sample inventory data: inventory_text.txt
Sample input screen:
What is the customer's name? Don Voils
What is the customer's address? 1313 Mocking Bird Lane
What is the item's number? 1234
That item is not in the inventory
Do you want to enter another item? (Y or y) Y
What is the item's number? 1212
How many of those items do you want? 10
Do you want to enter another item? (Y or y) Y
What is the item's number? 1531
How many of those items do you want? 2
Do you want to enter another item? (Y or y) N
Process another customer? N
Sample output screen:
Name: Don Voils
Address: 1313 Mocking Bird Lane
Item Number | Item Name | Unit Price | # Ordered | Item Amount |
---|---|---|---|---|
1212 | Thing1 | 12.54 | 10 | 125.40 |
1531 | Thing2 | 54.23 | 2 | 108.46 |
Invoice total $ | 233.86 |
Design:
design of the structure: inventory
design of the structure: item
structure chart: sc_invoice
pseudo code of the program: pc_invoices
Coding:
invoices.cpp
Maintenance:
Specification for modification:
You have been asked to make a modification to the invoice.cpp program. The following features are to be added.
The modified program is to be menu driven with the following menu options
Add items to the inventory
only if no other item exists with that item number
only if the number of items on inventory is less than 200.
Delete items from the inventory by inventory number
Enter and Display a customer's invoice
Save the inventory data when it ends
Design for modification:
design of the structure: inventory
design of the structure: item
structure chart: sc_invoice2
pseudo code of the program: pc_invoices2
Coding for modification:
invoices2.cpp