Write the code in c++ using visualstudio and fallow the instructions carefully!
(The dollar sign $ do not appear in all entries, just the first one )
Read carefully!
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:ICSIS223 folder and turn in a copy of the entire Lab02-SalesR 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 link as. to copy the file to your computer system. Copy the SalesRegister.txt file into the Lab02-SalesRegister folder. Open the file and check for a successful open, indicating that the file is actually available for input. Process these records using file streaming LIC #include #include #include #include #include "stdafx.h"
iostream ll for streaming file input I V'O manipulation (fixed, setprecision(2), left, right) using namespace std; const double MO SALES TAX RATE 8.84316; const double KS SALES TAX_RATE-8.868 double saleAmountCalc (int, double); double salesTaxCalc(double, string); void displaySaleData(string, double, double, string); customer name sale amount. .sales tax . state code MO base sales tax rate / KS base sales tax rate Il quantity..price / total sale amount .. state code 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 cach required function. 3. Declare an ifstream object within main) to handle streaming file VO. Copy the SalesRegister.txt 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 returned 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 returm. Return the amount of sales tax on each sales transaction. Store this double result in a sales tax variable declared in main0. 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. Use the void function displaySaleData to send each register line to cout. Pass the values of four 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). Declare a static char variable within the displaySaleData function to hold the value s . The function should set this value tojust before returning from a call to that routine. This will cause a blank character to be displayed on each line after the first record has been output with a dollar sign. Use the relevant input variables from each record as actual parameters when calling the two value- returning functions. Both return double values that can be stored in working variables declared within main0. The void display function requires two string values input from each file record (customer name, state code) and two calculated float values (sale amount, sales tax) as parameters. Declare suitable formal parameter names when implementing the bodies of all three called functions. Do not use the same names for formal parameters as the variables (declared in main0) used as actual parameters when these functions are called. There is no linkage whatever through any particular name when parameters are passed in a function call. The compiler makes all parameters passed by value available to the called routine by pushing each parameter value onto the program stack in reverse order Declare local variables where useful and appropriate. For instance, a locally-declared variable could be used to store the correct state sales tax amount within the salesTaxcalc function before returning that value, allowing the function to contain just a single return statement at the end of the routine (instead of two separate return statements within an if else control structure, for simpler and cleaner code. 9. Declare variables in main0 to collect and hold running totals of each sale amount, the calculated sales tax, and an accumulated sales tax amount each for Missouri and for Kansas. Add these values into the running total variables every time a record is processed. For efficiency, initialize these running totals to 0.00 upon declaration within main, before any amounts are added to them. Display these totals at the end of the program (as shown), after the loop for processing individual records ends and the input file has been closed. Line up decimal points and provide fixed dollar signs for values in the Total row SalesRegister.txt-Notepad CAVCProjectsOOP Lab02-SalesRegister' Debug)Lab02-Sale:Register File Edit Format View Help Haroldson Holder Bascomb Maartens Stivers Tomlin $ 188.68 $ 7.79 0 31.66 MO MO 140 1.29 733.50 395.55 431-46 418.80 26.9 KS 9 43.95 18.62 MO 18.84 0 11.38 KS 5.16 KS 22.92 MO 25.16 KS 110.28 KS 161.69 MO 8.20 MO 9.77 MO .68 KS 28.92 MO 32.38 KS 57.02 KS 17.73 HO 16.01 MO 34.96 MO 54 tivers MO MO 4.75 4 41.85 1 75.90 MO 18 29. 50 1 369.99 167.4 531.00 369.99 1621.75 3746.25 189.98 226.48 111.75 670.80 475.00 838.68 410.88 370.98 818.00 KS Pendleton Tr enton Bourne Madison Benton Graham Penniman wurtz Granvi1le Holder Saville Duncan Brent MO 75 49.95 2 94.99 MO 16 14.15 3 37.25 5 134.00 9. 50 KS 28 29.95 6.42 MO 10 37.09 6 135.00 KS MO KS older 50 MO 64 12774.91 652.11 Iotal MO Sales Tax: 376.31MO 275.80 IS Press any key to continue Follow standard style guidelines for identifiers (variables, named constants, and function names). Place the folder with the finished solution in your HACSIS223 folder. Submit a copy of the entire project folder for this Lab assignment on the X: drive (when that drive becomes available) for grading