Question: Sales Register Calculation and Display using Functions Create a Windows console program named Lab02-SalesRegister in a suitable folder. Copy the completed version to your own

 Sales Register Calculation and Display using Functions Create a Windows console
program named Lab02-SalesRegister in a suitable folder. Copy the completed version to
your own H:lICSIS223 folder and turm in a copy of the entire

Sales Register Calculation and Display using Functions Create a Windows console program named Lab02-SalesRegister in a suitable folder. Copy the completed version to your own H:lICSIS223 folder and turm in a copy of the entire Lab02-Sales Register project folder on drive X: when that drive becomes available. Copy the SalesRegister.txt file from C:lDatalCPPData or download from the Data Files folder in Black Board. Right-click on the file tag and select Save target asto copy the file to your computer system Copy the Sales Register.txt file into the Lab02-Sales Register folder. Open the file and check for a successfu open, indicating that the file is actually available for input. Process these records using file streaming /O #include "stdafx.h" #include #include #include domanip> /l for streaming file input l I/O manipulation (fixed, setprecision(2), left, right) using namespace std; const double MO SALES-TAX RATE = 0.04316; const double KS-SALES-TAX-RATE=0.068; double saleAmountCalc (int, double); double salesTaxCalc(double, string); // MO base sales tax rate // KS base sales tax rate quantity.. price / total sale amount . state code id displaySaleData (string, double, double, string); /customer name sale amount sales tax state cod int main) 1. Named constant values hold the state-wide base sales tax rates for Missouri and Kansas. 2. Function prototypes declare the return type and parameter types for each required function. 3. Declare an ifstream object within main) to handle streaming file I/O. Copy the SalesRegister.txct 4. Declare variables in the main routine to hold four variables input from the file (customer name string, Implement each of the function after the end of the main) routine input file into the Lab02-SalesRegister project folder. Open the file and test for a successful open. state code string, int quantity sold, and double item price). Add two double variables to hold calcu- lated values of total sales amount and sales tax amount retumed by the two value-returning functions. 5. Implement all three functions declared as function prototypes implemented in code after the end of the main) function body. Call each of these three functions from within the main) routine. The saleAmountCalc function takes two parameters-quantity sold and item price. Multiply these two values within the function and return total sales amount as a double value when the function is executed. Store this result in a sales amount variable declared in maino. 6. salesTaxCalc accepts two parameters- the calculated total sales amount and a state code string used to determine the correct amount of sales tax to return. Return the amount of sales tax on each sales transaction. Store this double result in a sales tax variable declared in mainO. Use the Kansas tax rate when the state code is equal to "KS". Otherwise, use the Missouri rate. This default behavior avoids the need for extra code to handle an invalid state entry (Missouri is assumed). 7. Pass the values of four Use the void function displaySaleData to send each register line to cout. individual parameters to this routine - customer name, the calculated sales amount and sales tax values returned by two of the functions, plus the state code (displayed immediately after the sales tax amount). 8

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!