omers. These customers place their orders as follows: Center has a program called crooked which processes data in a file crooked.txt esenting orders. Each line in the file contains three quantities, an inventory number, the unt ordered and a price. It is not known how many orders are placed by each customer, but e containing three zeros is used to signal the end of a customer's transaction. Processing the one by one, the program totals the order and the number of items ordered; calculating the ounts on each item according to the following table: ount Ordered Discount r below 5% 50 10% 75.25% Use num 1111 2222 3333 0 4444 5555 0 6666 7777

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
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.txt
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. Write a method called
serviceCharge which should calculate and print the total price and service charge as follows:
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
there is no service charge.
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
1111
25
2222
14
3333
30
0
0
4444
35
5555
78
0
0
6666
5
7777
8
8888
10
0
0
9999
52
1000
121
2000
24
0
0
3000
2
4000
40
5000
1
000
6000
14
7000
38
8000
70
9000
0
2
0
price
2.32
1.81
4.61
0
8.61
10.62
0
52.61
4.91
.24
0
1.32
.68
2.69
0
152.68
29.60
1.40
100.00
52
1.02
90.45
0
Transcribed Image Text: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.txt 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. Write a method called serviceCharge which should calculate and print the total price and service charge as follows: 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 there is no service charge. 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 1111 25 2222 14 3333 30 0 0 4444 35 5555 78 0 0 6666 5 7777 8 8888 10 0 0 9999 52 1000 121 2000 24 0 0 3000 2 4000 40 5000 1 000 6000 14 7000 38 8000 70 9000 0 2 0 price 2.32 1.81 4.61 0 8.61 10.62 0 52.61 4.91 .24 0 1.32 .68 2.69 0 152.68 29.60 1.40 100.00 52 1.02 90.45 0
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY