Question: C++ PROGRAMMING FUNCTIONS Customer Receipt Write a program that calculates the receipt for a customers purchase. I. Define the following functions: 1. A function that
C++ PROGRAMMING FUNCTIONS
Customer Receipt Write a program that calculates the receipt for a customers purchase. I. Define the following functions: 1. A function that prompts the user for an item name and cost. Function prototype: void GetItem(string &name, float &cost); Input validation: The cost cannot be less than 0. 2. A function that calculates the subtotal of three items. Function prototype: float CalculateSubTotal(float cost1,float cost2,float cost3); 3. A function that calculates and returns 6% of a float value. Function prototype: float CalculateTax(float sub); 4. A function that displays a receipt as follows: Items Cost ----------------- sweater $25.00 shoes $37.00 pants $26.00 Subtotal: $88.00 Tax: $5.28 Total: $93.28 Function prototype: void DisplayReceipt(string name1, string name2, string name3, float cost1, float cost2, float cost3, float sub, float tax); II. In main(): 1. Declare the following variables: item1Name1, item2Name, item3Name, item1Cost, item2Cost, item3Cost, subtotal and totaltax 2. Call the function GetItem three times to prompt for three item names and costs. 3. Call the function CalculateSubTotal to calculate the total of the three items and store this value in subtotal. 4. Call the function CalculateTax to calculate the sales tax and store this value in totaltax. 5. Call the function DisplayReceipt.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
