Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed
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 31 -50 51- 75 above 75 5% 10% 25% 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 ofparts 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. All output is to be sent to a file, crookedSales.txt. You are to use as few if statements a possible. Be sure to comment and indent your program as discussed in class. 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 31 -50 51- 75 above 75 5% 10% 25% 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 ofparts 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. All output is to be sent to a file, crookedSales.txt. You are to use as few if statements a possible. Be sure to comment and indent your program as discussed in class

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Transact SQL Cookbook Help For Database Programmers

Authors: Ales Spetic, Jonathan Gennick

1st Edition

1565927567, 978-1565927568

More Books

Students also viewed these Databases questions

Question

What are the determinants of cash cycle ? Explain

Answered: 1 week ago