subject

In this assignment, you will write a program in C++ that uses files and nested loops to create a file for real estate agents home sales and then read the sales from the file and calculates the average sale for each agent. Each agent sold 4 homes. Use a nested loop to write each agent’s sales to a file. Then read the data from the file in order to display the agent’s average sale and the average for all sales. Determine which agent had the highest total sales and display their name and total sales Enter 4 sales for each agent. Column 1 is the agent’s name and Column 2-5 are their sales in 1000’s.
Agent House 1 House 2 House 3 House 4
Martha 90 125 60 125
Leela 55 25 75 100
Jorge 130 60 70 100
Requirements:
Use a nested loop structure to input the data and Write the data to a text file.
The outer loop will be a while loop (while more agent and agent’s name), the inner loop will be a for loop (4 sales).
Validate whether the sale prices are in range (0-200).
Since you do not know how many agents will be entered, add a way to quit the loop.
Add spaces in between each item added to the text file. Add a new line after each agent. The text file that your program creates will look like the following
Use a nested loop structure to read the data from the text file and calculate the agent’s average sale.
The outer look will be a while loop; the inner loop will be a for loop (4 sales)
To calculate each agent’s average sale, use an accumulator (total variable) initialized to 0 before the for loop, then calculate the agent’s average after the loop. You will need to set the total agent variable to 0 after you calculate the average.
To calculate the total average sale, you will need an accumulator for the company. add each agent’s total into the total agency variable following the for loop, then calculate the agency average after the while loop.
Only display 2 decimals for the averages.
BEWARE of integer division.
Use cout to output the values of the variables to the console. Your cout statement MUST use the variables to display the values

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 19:00
Which parts of a presentation should be the most general? a. introduction and conclusion b. introduction and outline c. outline and conclusion d. outline and body
Answers: 1
question
Computers and Technology, 22.06.2019 19:10
10. when you create a pivottable, you need to specify where to find the data for the pivottable. is it true
Answers: 2
question
Computers and Technology, 22.06.2019 21:50
Given int variables k and total that have already been declared, use a while loop to compute the sum of the squares of the first 50 counting numbers, and store this value in total. thus your code should put 11 + 22 + 33 + + 4949 + 50*50 into total. use no variables other than k and total.
Answers: 2
question
Computers and Technology, 24.06.2019 00:20
Describe a data structures that supports the stack push and pop operations and a third operation findmin, which returns the smallest element in the data structure, all in o(1) worst-case time.
Answers: 2
You know the right answer?
In this assignment, you will write a program in C++ that uses files and nested loops to create a fil...
Questions
question
Mathematics, 14.07.2019 14:00
Questions on the website: 13722363