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, 24.06.2019 00:40
What is the error in the following pseudocode? module main() call raisetopower(2, 1.5) end module module raisetopower(real value, integer power) declare real result set result = value^power display result end module
Answers: 1
question
Computers and Technology, 24.06.2019 14:30
Which computer network component connects two different networks together and allows them to communicate? a is a node (or a device) that connects two different networks together and allows them to communicate.
Answers: 1
question
Computers and Technology, 24.06.2019 16:00
"gps interaction and cognitive process" respond to the following: imagine that you have been asked to design a gps product that will have voice recognition and bluetooth capability. discuss and conceptualize a user interaction model. predict two (2) problems that may arise in gps products with voice recognition and bluetooth capability. recommend solutions for each of these issues. attention is one of the six cognition processes. when attention is applied to a design, the goal is to make it easier for the end user to quickly locate where he / she should type information on the computer or mobile device screen. compare and contrast how the google search engine and the microsoft bing search engine employ the attention cognition process. provide your opinion as to which search engine better employs the attention cognition process and explain why.
Answers: 3
question
Computers and Technology, 24.06.2019 17:00
Anew author is in the process of negotiating a contract for a new romance novel. the publisher is offering three options. in the first option, the author is paid $5,000 upon delivery of the final manuscript and $20,000 when the novel is published. in the second option, the author is paid 12.5% of the net price of the novel for each copy of the novel sold. in the third option, the author is paid 10% of the net price for the first 4,000 copies sold, and 14% of the net price for the copies sold over 4,000. the author has some idea about the number of copies that will be sold and would like to have an estimate of the royal- ties generated under each option. write a program that prompts the author to enter the net price of each copy of the novel and the estimated number of copies that will be sold. the program then outputs he royalties under each option and the best option the author could choose. (use appropriate named constants to store the special values such as royalty rates and fixed royalties.
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
Physics, 06.07.2019 02:30
question
Mathematics, 06.07.2019 02:30
question
Geography, 06.07.2019 02:30
Questions on the website: 13722363