The local high school student council is selling pizzas for a fund raiser. In order to keep things simple, there are only two sizes of pizza available, and all pizzas on one order must be the same type (size and number of toppings). Write a program to help compute the charge for one order.
Customers may order medium or large pizzas. All pizzas on one order must be the same size. Prices are 4.99 for medium pizzas, and 7.99 for large pizzas.
Pizzas are standard cheese pizzas with no toppings. If the customer to add toppings, they are charged 85 cents for each additional topping. All pizzas on one order must have the same number of toppings.
If the customer wants the order delivered, there is a 12% delivery fee.
If the customer is a student council member, they will receive 90 cents off each pizza ordered.
The program should output a pizza bill, formatted as shown on the next page.
The program must use constants for ALL fixed values (therefore, there should be no hardcoded numbers in your program).
The program shall use descriptive names for all constants and variables, and follow the naming conventions in the Coding Standards.
The program shall use double type constants and variables for all floating point values (not float).
The user will enter the following input:
The pizza size
Read the pizza size as a single character ( 'm'/'M' for medium or 'l'/'L' for large). The user may enter the character in either upper or lowercase. Use a pre-defined function from the cctype library to insure that the character is stored in uppercase when your code uses the value later to decide what to charge and what to display.
The number of toppings the customer wants on each pizza
Whether the customer is a student council member
Read answer from the user as a string: "yes" or "no"
The prompt should indicate that the string must be entered in all lowercase letters.
The string value entered will be tested later, to decide whether to give a discount.
Whether the customer wants the pizza delivered
Read from the user as a single character ( 'd'/'D' for delivery, 'p'/'P' for pickup).
After reading the input character, the program will store a value into a Boolean variable called deliver (true for customers who want delivery, false for customers who will pick up their own pizza) and use only that Boolean in later processing, when testing the value to decide whether to charge for delivery.
The user may enter the character in either upper or lowercase. The program must use a logical operator to test for both upper and lowercase when deciding whether to store true or false in the Boolean value (i.e. Use a logical operator instead of using a cctype predefined function).
NOTE: No error checking of the user input is required. You may assume that the user entered a valid answer for each question, and assume also valid input for test cases.
Required User-Defined Function:
Create separate a user-defined function to calculate the per pizza charge.
The function will take two input parameters: the pizza size amd the number of toppings.
It is not our intention to break the school's academic policy. Projects posted are only used as a reference
and should not be submitted as is. We are not held liable for any misuse of the solutions.
Please see the frequently asked questions page
for further questions and inquiries.
Kindly fill out the form.
Please provide a valid email address and we'll get back to you in less than 24 hours.
We will be sending an invoice through PayPal upon confirmation.
We are a non profit organization however we need an amount to keep this organization running,
and to be able to complete our research and development.