Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

SalesRegister.txt Haroldson MO 140 1.29 Holder MO 90 8.15 Bascomb KS 9 43.95 Maartens MO 54 7.99 Stivers MO 88 4.75 Tomlin KS 4 41.85

image text in transcribedimage text in transcribed

SalesRegister.txt

Haroldson MO 140 1.29 Holder MO 90 8.15 Bascomb KS 9 43.95 Maartens MO 54 7.99 Stivers MO 88 4.75 Tomlin KS 4 41.85 DuPuy KS 1 75.90 Pendleton MO 18 29.50 Trenton KS 1 369.99 Bourne KS 325 4.99 Madison MO 75 49.95 Benton MO 2 94.99 Graham MO 16 14.15 Penniman KS 3 37.25 Wurtz MO 5 134.00 Granville KS 50 9.50 Holder KS 28 29.95 Saville MO 64 6.42 Duncan MO 10 37.09 Brent MO 6 135.00

CSIS 223 Object-Oriented Programming with C++ Lab02-Sales Declare a static char variable within the displaySaleData function to hold the valuc ''. The Sales Register Calculation and Display using Functions Create a Windows console program named Lah02-SalesRegister in a suitable folder. Copy the completed a blank character to be displayed on each line after the first record has been output with a dollar sign. Usc the rclevant input variables from each record as actual parameters when calling the two value- rcturning functions. Both return double values that can be stored in working variables declared within main. The void display function requires two string values input from each file record (customer :CSIS223 fol taiCPPData or to Copy the SalesRegister.txt file into the Lab02-Sales Register 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 O. inc Lude int lude string 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 main)) used as actual parameters when these functions are calld. There is no linkage whatever through any particular name when paramcters 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. stdat Declare local variables where useful and appropriate. For instance, a locally-dlared 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 retun statement at the end of the routine (instead of two separate return statements within an if.. else control structure, for simpler and clcaner code. sing namespace 9. Declare variables in main0 to collect and hold running totals of each sale amount, the calculated double double saleAmountCalc(int, double) salesTaxcalc (double, string); for splaysale 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 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. Implement each of the fiunction after the end of the main routine. input file into the Lab02-SalesRegister project folder. Open the filc and test for a successful open 4. Declare variables in the main routine to hold four variables input from the file (customer name string, state code string, int quantity sold, and double item price). Add two double variables to hold calu- lated valucs of total sales amount and sales tax amount returned by the two value-retuming functions 369 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. 6 The saleAmountCalc function takes two parameters-quantity sold and item price. Multiply these two values within the function and rcturn total sales amount as a double valuc when the function is executed. Store this result in a sales amount variable declared in mainO. 7. 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 main. Usc the Kansas rate bchavior avoids the need for extra code to handle an invalid state entry (Missouri is assumed). Use the void function displaysaleData to send each register line to cout. returned by two of the functions, plus the state code (displayed immediately after the sales tax amount). 8. Pass the values of four ues 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

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

Step: 3

blur-text-image

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

Database Management System MCQs Multiple Choice Questions And Answers

Authors: Arshad Iqbal

1st Edition

1073328554, 978-1073328550

More Books

Students also viewed these Databases questions

Question

=+2. What steps lead to the initiation of a voluntary movement?

Answered: 1 week ago