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 17:30
Ou listened to a song on your computer. did you use hardware or software?
Answers: 2
question
Computers and Technology, 22.06.2019 18:30
Which of the following commands is more recommended while creating a bot?
Answers: 1
question
Computers and Technology, 22.06.2019 20:30
In this lab, you complete a prewritten c program that calculates an employee’s productivity bonus and prints the employee’s name and bonus. bonuses are calculated based on an employee’s productivity score as shown below. a productivity score is calculated by first dividing an employee’s transactions dollar value by the number of transactions and then dividing the result by the number of shifts worked.
Answers: 3
question
Computers and Technology, 23.06.2019 12:40
Curriculum exam to process a resident's payment, you must click on onesite payments home page. from the a. reports b. my settings o c.transactions o d. rent tab
Answers: 1
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, 11.09.2020 19:01
question
Mathematics, 11.09.2020 19:01
question
Mathematics, 11.09.2020 19:01
question
History, 11.09.2020 19:01
question
Mathematics, 11.09.2020 19:01
question
Mathematics, 11.09.2020 19:01
question
Mathematics, 11.09.2020 19:01
question
Mathematics, 11.09.2020 19:01
question
Mathematics, 11.09.2020 19:01
question
Health, 11.09.2020 19:01
question
Mathematics, 11.09.2020 19:01
question
Mathematics, 11.09.2020 19:01
question
Mathematics, 11.09.2020 19:01
question
Mathematics, 11.09.2020 19:01
question
Health, 11.09.2020 19:01
question
Mathematics, 11.09.2020 19:01
question
Mathematics, 11.09.2020 19:01
question
English, 11.09.2020 19:01
question
Mathematics, 11.09.2020 19:01
question
Chemistry, 11.09.2020 19:01