subject

In c++ in this assignment, you will write a program that will read in a list of 12 doubles from a file. each double represents the total rainfall in inches for the 12 months of the year in month order. the 12 doubles should be written into an array. the program should do the following with the data: ? calculate the average rainfall for the year. ? determine which month had the lowest amount of rainfall. ? determine which month had the highest amount of rainfall. ? sort the array of rainfall in descending order (highest rainfall first) using a bubble sort. ? neatly display the average, minimum, and maximum rainfall. be sure to display the month of the minimum and maximum rainfalls. then display a table of month and rainfall amount from the sort that you did earlier. each of the monthly rainfall, average, minimum, and maximum rainfalls should be displayed to two decimal places. you will not be given a sample program for this assignment. you have already done a similar program for reading in values from a file and finding averages, minimums, and maximums. the most difficult part of the assignment will be to display the correct months with the correct rainfall values after you have sorted them. i would suggest using parallel arrays for rainfall and months and every time you swap array indices for rainfall, you do the same swap for the months. make sure you use good programming style. this includes commenting all your variables and commenting through your code. comments should explain why you are doing something. use good indentation (see my examples and the books examples for demonstration of good indentation). make sure variable names are self-documenting. make good use of white space. group logical sections together with one blank line between logical sections. your output should be neat and pleasant to read. make sure you follow the specifications. if you must, you can add to the program, but do not change the specifications in doing so. name your file pa4_lastname_firstname. cpp, replacing lastname with your actual last name and firstname with your actual first name. failure to properly name your file results in loss of points. cosc 1436 programming assignment 4 below is possible output for a sample run for this programming assignment: monthly rainfall for fort worth, tx 2014 minimum: september 0.06 maximum: august 4.34 monthly average for year: 1.77 sorted by total rainfall month inches august 4.34 may 3.40 june 3.26 november 2.13 october 2.09 april 1.74 march 1.45 december 1.13 july 0.98 february 0.41 january 0.33 september 0.06

ansver
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 04:30, fatherbamboo
Dr. wisteria is a prominent chiropractor in the chicago area. she wants to provide a forum for her patients to discuss their health concerns and to seek and offer advice to other patients. which telecommunications tool is most appropriate for dr. wisteria's needs?
Answers: 3
image
Computers and Technology, 22.06.2019 10:40, vannahboo2022
Program using c++ only on visual studio pig is a simple two player dice game, played with one die. the first player to reach or surpass 50 is the winner. each player takes a turn rolling the dice. they add to the pot with each roll, having to decide to roll again and increase the pot, or cash out. the risk being they could lose the amount they’ve accumulated into the pot. the rules for each player’s die roll. 1. roll the dice. a. if user rolled a 1, i. the pot gets set to zero ii. the other player goes to step 1. b. a roll of 2-6 is added to the pot. 2. user can choose to hold or roll again. a. choice roll. return to step 1. b. choice hold. i. increment player score by the pot amount. ii. pot gets set to 0. iii. second player gets to roll and goes to step 1. program requirements: ● before each opponent begins ○ output the score for the person and the computer. ○ output the opponents whose turn is beginning and ask the user to hit enter to continue. ● with each dice roll. ○ output the die value, and amount of the round pot. ○ if it’s the users roll ask if they want to roll again ( r ) or hold ( h ). your program should allow r, r, h or h as valid input. if input is anything else, ask the user again until valid input is obtained. ○ the ai will continue playing until the round pot is 20 or more. ● once a player’s score is greater or equal to 50 then they have won, it will no longer ask if they want to keep rolling the die or not. ● once there is a winner ○ score totals are output along with who the winner was. user or computer ○ player is asked if they want to play again y or n. valid input should be y, y, or n, n. ● when a new game starts the starting roll goes to the player that did not roll last. if the user rolled last in the previous game, then the computer rolls first and vice versa. when the program first begins, the player will make the first roll of the first game. development notes : ● you will need a way to roll dice in your program. the rand() function works well, but returns an integer. if we want numbers 0 – 9 we can get the value modulus 10. ● call srand() with a value to seed it. it’s common to seed it with the current computer clock, include ctime, and then call srand(time(
Answers: 1
image
Computers and Technology, 22.06.2019 17:30, yoyo9661
Under which key category do the page up and page down keys fall? page up and page down keys fall under the keys category.
Answers: 1
image
Computers and Technology, 22.06.2019 22:30, josephmelichar777
Write a full class definition for a class named player , and containing the following members: a data member name of type string .a data member score of type int .a member function called setname that accepts a parameter and assigns it to name . the function returns no value. a member function called setscore that accepts a parameter and assigns it to score . the function returns no value. a member function called getname that accepts no parameters and returns the value of name .a member function called getscore that accepts no parameters and returns the value of score .this is what i have, aparently this is wrong: class player{private: string name; int score; public: void player: : setname (string n){name =n; }void player: : setscore (int s){score = s; }string player: : getname (){return name; }int player: : getscore (){return score; }};
Answers: 2
You know the right answer?
In c++ in this assignment, you will write a program that will read in a list of 12 doubles from a fi...

Questions in other subjects:

Konu
History, 18.01.2022 01:00
Konu
Mathematics, 18.01.2022 01:00
Konu
Biology, 18.01.2022 01:00