Question: Please write a c++ code with proper use of variable constants for my pseudo code. I am take a class that is teaching me flow

Please write a c++ code with proper use of variable constants for my pseudo code. I am take a class that is teaching me flow charts and pseudocode and I would like to see the actual code so that I can start preparing myself for next semesters classes. Here is the pseudo code:

// main module

Module main()

// Local variables

Declare InputFile salesFile

Declare Integer count = 0, readNumber, lastNumber

Declare Real readAmount, personTotal = 0, allTotal = 0

// open file

Open salesFile brewster.dat

// print headings

Display Brewsters Used Cars, Inc.

Display sales Report

Display

Display Salesperson ID Sale Amount

Display ===================================

// read and display all sales in the file

While NOT eof(salesFile)

Read salesFile readNumber readAmount

Set count = count + 1

// initialize

If count == 1 Then

Set lastNumber = readNumber

End If

// check if sales ID changed

If readNumber != lastNumber Then

Display Total sales for this salesperson: , personTotal

Display

Set personTotal = 0

Set lastNumber = readNumber

End If

// accumulate totals

Set personTotal = personTotal + readAmount

Set allTotal = allTotal + readAmount

End While

// closing totals

Display Total sales for this salesperson: , personTotal

Display Total of all sales: , allTotal

// close the file

Close numbersFile

End Module

Output should look like this:

Use the provided 'brewster.dat' file to generate this output:

Brewster's Used Cars, Inc. Sales Report Salesperson ID Sale Amount ====================================== 100 $10000.00 100 $12000.00 100 $5000.00 Total sales for this salesperson: $27000.00 101 $14000.00 101 $18000.00 101 $12500.00 Total sales for this salesperson: $44500.00 102 $13500.00 102 $14500.00 102 $20000.00 Total sales for this salesperson: $48000.00 Total of all sales: $119500.00

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!