programming assignment #2 in cis12 please use speaker notes for additional information!

5
Programming Assignment #2 in CIS12 Please use speaker notes for additional information!

Upload: harold-cameron

Post on 18-Jan-2016

216 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Programming Assignment #2 in CIS12 Please use speaker notes for additional information!

Programming Assignment #2 in CIS12

Please use speaker notes for additional information!

Page 2: Programming Assignment #2 in CIS12 Please use speaker notes for additional information!

121212Stephen Daniels Jean Shorts 0150002123456Jennifer Ames Sandals 0299901144445Susan Richards Sweater 0499501145678John Smith Tank Top 0109904212121Linda Costa Socks 0029910242424Michael Fletcher Suit 2259501252728Russell Warren Coat 1999801272817Ann Washington Gown 5000001300456Dick Southworth Sweatshirt 0159902454567Mary Stretton Bathrobe 0259701

The file layout is:

1 - 6 Customer Number 7 - 26 Customer Name 27 - 46 Product 47 - 51 Standard Price 52 - 53 Classification

Note that the standard price is 5 characters made up of 3 whole numbers and 2 decimal numbers.

Customer.datCustomer.dat

Page 3: Programming Assignment #2 in CIS12 Please use speaker notes for additional information!

Output requirementsOutput 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.

Page 4: Programming Assignment #2 in CIS12 Please use speaker notes for additional information!

Classification codes

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

Page 5: Programming Assignment #2 in CIS12 Please use speaker notes for additional information!

Possible outputPossible output

121212 Stephen Daniels Jean Shorts $15.00 $15.00 Steady123456 Jennifer Ames Sandals $29.99 $26.99 Excellent144445 Susan Richards Sweater $49.95 $44.95 Excellent145678 John Smith Tank Top $10.99 $12.08 Irregular212121 Linda Costa Socks $2.99 $4.28 Problem

Note that there are additional records - this is only partial output.

The calculated price and the classification name are the last two fields - the other data comes directly from the input.