Programming Assignment #2 in CIS12

Download Report

Transcript Programming Assignment #2 in CIS12

Programming Assignment #2 in
CIS12
Please use speaker notes for
additional information!
Customer.dat
The file layout is:
Note that the standard price is
5 characters made up of 3
whole numbers and 2 decimal
numbers.
121212Stephen Daniels
123456Jennifer Ames
144445Susan Richards
145678John Smith
212121Linda Costa
242424Michael Fletcher
252728Russell Warren
272817Ann Washington
300456Dick Southworth
454567Mary Stretton
1
7
27
47
52
Jean Shorts
Sandals
Sweater
Tank Top
Socks
Suit
Coat
Gown
Sweatshirt
Bathrobe
-
6
26
46
51
53
Customer Number
Customer Name
Product
Standard Price
Classification
0150002
0299901
0499501
0109904
0029910
2259501
1999801
5000001
0159902
0259701
Output requirements
The detail output should include the following:
Customer Number - this is taken directly from the input record
Customer Name - this is taken directly from the input record
Product - this is taken directly from the input record
Standard Price - this is taken directly from the input record (3 whole numbers, 2
decimal)
Customer Special Price - this is the result of a calculation - this is handled differently
depending on whether the classification code is 01, 02, 04 or 10
Classification Name - a different name is printed depending on whether the
classification code is 01, 02, 04, or 10
The total output should include the number of records processed in each classification therefore, the program should add to different counters depending on whether the
classification code is 01, 02, 04, or 10. NOTE: There should be four totals.
Classification
codes
Recommendation:
I would suggest that in the loop where you are processing the records, you check the
classification code. There are three things to do dependent on that classification code:
• Calculate the special price
• Move the classification name to the printer
• Add to the appropriate classification counter
Possible output
The calculated price and the
classification name are the last two
fields - the other data comes directly
from the input.
121212
123456
144445
145678
212121
Stephen Daniels
Jennifer Ames
Susan Richards
John Smith
Linda Costa
Jean Shorts
Sandals
Sweater
Tank Top
Socks
$15.00
$29.99
$49.95
$10.99
$2.99
$15.00
$26.99
$44.95
$12.08
$4.28
Steady
Excellent
Excellent
Irregular
Problem
Note that there are additional records - this is only partial output.