Question
Using C++ Write a program that will compute the amount owed to a school supply store. Information to know: The cost of a pencil is
Using C++
Write a program that will compute the amount owed to a school supply store.
Information to know:
The cost of a pencil is 12 The cost of a pen is 16 The cost of an eraser is 22 The cost of a ruler is 40
There is a discount based on the quantity purchased. If you purchase a 100 or more of any one item you get a 15% discount. After the cost is determined, there is a 7.5% sales tax.
The program should have the following functions:
displayMenuGetSelection- This function displays the menu to the screen and asks the user to enter their selection. It returns the selection as a character.
processOrder- This function has the cost needed to process the order passed in. It then calls the functions to get a valid quantity, calculates the bill and prints the receipt. It does not return a value.
getValidQuantity This function asks the user to type in the quantity. It makes sure that the quantity is a positive value and then returns the positive integer.
calculateBill This function has the cost and quantity passed in. It also determines the discount, so that is passed in, too. The function determines the discount rate and calculates the cost that is due. It returns the cost that is due.
determineDiscount This function is called from within calculateBill. It uses the quantity passed in to determine if there is a discount and returns the constant discount or zero, depending on whether there is a discount or not.
printReceipt This prints the receipt to the screen. All values to be printed are needed.
main main only calls two methods displayMenuGetSelection and processOrder. It has a switch statement and calls processOrder with the appropriate price constant as an argument.
Requirements
There should be SIX constants: the cost of a pencil, the cost of a pen, the cost of an eraser, the cost of a ruler, the tax, and the discount
Comments should be at the top of all files that you turn in with your name, class, etc.
You must use a switch statement in main.
The program should compute the correct answer for all proper input. The output given does NOT test all possibilities, but the program should work for all input
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started