C.I.S. 1.50

Professor Langsam

Assignment #2

 

The Crooked Wholesale Distributing Center (with offices in all five boroughs) has a total of ten customers. These customers place their orders as follows:

 

The Center has a program called crooked which processes data in a file crooked.dat representing orders. Each line in the file contains three quantities, an inventory number, the amount ordered and a price. It is not known how many orders are placed by each customer, but a line containing three zeros is used to signal the end of a customer's transaction. Processing the lines one by one, the program totals the order and the number of items ordered; calculating the discounts on each item according to the following table:

 

                                    Amount Ordered                      Discount

                                       30 or below                                 5%

                                          31 - 50                                    10%

                                          51 - 75                                    25%

                                         above 75                                  40%

 

Print the following for each customer, the inventory number, the amount ordered, the original price, the discount and the new price. Head these five columns with Number, Amount, Old Price, Discount, and New Price respectively.

 

When there are no more transactions for that customer, the program skips 4 lines and calculates the postage and handling charge based upon the total order. If the order is under $500 the program adds a $20 service charge to the balance and then prints the final balance followed by the message: $20 Service Charge. If the order is greater than or equal to $500 but the total number of parts is less than 50 a 5% discount is applied prior to printing the total order followed by the message: 5% Discount. Otherwise the program prints the total order for that customer.

 

Skip 5 lines and process the next customer. The program stops after it has done this for all ten customers.

 

Your assignment is to write the program crooked. Please submit your program, data file and output. You are to use as few if statements as possible. Be sure to comment and indent your program as discussed in class.


Use the following sets of data:

 

          number                   amount                     price           

              1111                           25                            2.32

              2222                           14                            1.81

              3333                           30                            4.61

                    0                             0                            0

 

              4444                           35                            8.61

              5555                           78                         10.62

                    0                             0                            0

 

              6666                             5                          52.61

              7777                             8                            4.91

              8888                           10                              .24

                    0                             0                            0

 

              9999                           52                            1.32

              1000                         121                              .68

              2000                           24                            2.69

                    0                             0                            0

 

              3000                             2                       152.68

              4000                           40                          29.60

              5000                             1                            1.40

                    0                             0                            0

 

              6000                           14                       100.00

              7000                           38                              .52

              8000                           70                            1.02

              9000                             2                          90.45

                    0                             0                            0

 

 

            Make up four more sets (using reasonable numbers).