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 04:00
Which spereadsheet type will determine how well a bussiness has done over the past year
Answers: 1
question
Computers and Technology, 22.06.2019 22:00
Researchers measured the data speeds for a particular smartphone carrier at 50 airports. the highest speed measured was 78.1 mbps. the complete list of 50 data speeds has a mean of x overbarequals16.11 mbps and a standard deviation of sequals18.65 mbps. a. what is the difference between carrier's highest data speed and the mean of all 50 data speeds? b. how many standard deviations is that [the difference found in part (a)]? c. convert the carrier's highest data speed to a z score. d. if we consider data speeds that convert to z scores between minus2 and 2 to be neither significantly low nor significantly high, is the carrier's highest data speed significant? a. the difference is nothing mbps.
Answers: 3
question
Computers and Technology, 23.06.2019 09:30
Write a function called checkfactor that takes two arrays of positive numbers, firstnumberrow and secondnumberrow. checkfactor checks if the first entry in firstnumberrow is divisible by the first entry in secondnumberrow, and performs the same operation on the next array elements until all entries have been checked. all the numbers are positive and the number of entries in the arrays are the same. the function should return the identified divisible numbers in two row arrays named firstdivisible and seconddivisible.restrictions: branches or loops should not be used. the code must use the internal mod and logical functions.hint: the mod function should be used to determine if two numbers are divisible. ex: for num1 and num2 if mod(num1,num2) is 0, then the two numbers are divisible.this is matlab
Answers: 2
question
Computers and Technology, 23.06.2019 11:30
In cell h5 enter a formula that will calculate the percentage of attendees that went to the altamonte springs job fair in 2018.
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, 27.02.2020 03:30
question
Mathematics, 27.02.2020 03:30
Questions on the website: 13722367