Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In C++ Description: Write a program that will compute the amount owed to a school supply store. Information to know: The cost of a pencil

In C++

Description:

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

1. The program must be called main.cpp

2. If the program does not compile, it is a zero. 3. Submit the C++ file to moodle by the due date. If the incorrect file is submitted it will be a zero. (Check to make sure the correct file is uploaded)

4. 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

5. Your output should be identical (except for your name) to the output given when the input given is typed in, this includes spacing.

6. Comments should be at the top of all files that you turn in with your name, class, etc.

7. You must use a switch statement in main

8. 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.

Words of Wisdom

1. Do NOT enter all of the program in at one time and then compile and run it.

2. DO NOT WAIT UNTIL THE LAST MINUTE!!!! Things come up with computers. Try to start assignments as soon as you get them.

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_2

Step: 3

blur-text-image_3

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

SQL Server T-SQL Recipes

Authors: David Dye, Jason Brimhall

4th Edition

1484200616, 9781484200612

More Books

Students also viewed these Databases questions