Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Purpose: This experiment is designed to develop confidence with structs. Readings: The experiment focuses upon the material on structs covered in the text and in

Purpose:
This experiment is designed to develop confidence with structs.
Readings:
The experiment focuses upon the material on structs covered in the text and in the module.
Instructions:
You have been tasked with writing a C++ program to generate a quarterly sales report for your company. The data is in the "sales.txt" file (A zipped file under the Materials category in this week's module on Canvas). This file contains records similar to:
2013-1003 B 120.00
The first field is the invoice number which is not used, the second is an equipment code and the third is the cost of the parts on that order. The equipment code will be:
A Capital Equipment
B Expensed Equipment
C Small Parts
Your program should read a line from the file into a struct, pass the struct and three accumulator variables to a function and then continue reading lines and calling the accumulator function until it reaches end of file. It should then call the writeReport function to write the report into a text file, inventoryReport.txt:
S A L E S R E P O R T
\table[[Capital Equipment,$24093.18,26.318],[Expensed Equipment,$22222.80,24.278],[Small Parts,$45251.98,49.428]]
The prototype of the accumulator function will be similar to: void acoumulate (const SalesRecord &s, double & oapSales, double &eqpSales, double & prtSales) ;
Experimenter Notes:
Write a paragraph in acceptable, well-formed English sentences. The paragraph should detail the information that you have gleaned from this experiment. Be sure to include comments on what happened that was unexpected.
Why did we pass the struct as a reference variable?
Why did we declare it as const?
Does it make sense to do both? Explain why it does or does not.
image text in transcribed

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

Seven Databases In Seven Weeks A Guide To Modern Databases And The NoSQL Movement

Authors: Eric Redmond ,Jim Wilson

1st Edition

1934356921, 978-1934356920

More Books

Students also viewed these Databases questions

Question

16.4 Autoregressive Models

Answered: 1 week ago