The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Jul 2017 |
| Last Sign in: | 314 Weeks Ago |
| Questions Answered: | 15833 |
| Tutorials Posted: | 15827 |
MBA,PHD, Juris Doctor
Strayer,Devery,Harvard University
Mar-1995 - Mar-2002
Manager Planning
WalMart
Mar-2001 - Feb-2009
Hi Mr.Ashish, I have an assignment need you to help relate to array in C++.
This program will process monthly precipitation amounts and user requests.
1.      This program will process arrays of data to provide information to the user.
2. Create 5 functions
a. queryUser();
                       i.  prompts the user for an action and then returns an integer based on user choice
·        1 to print all
·        2 to calculate differences and print all
·        3 to see a single month
·        4 or more to quit
b. processQuery (int query, string month[], double actual[], double average[], intsizeOfArrrays);
                       i.  checks the user query and calls a function based on the query
                      ii.  Use a switch case
·        1 calls printAllArrays
·        2 calls calcAllDifferences
·        3 calls displaySingleMonth
c. printAllArrays (string month[], double actual[], double average[], intsizeOfArrrays);
                       i.  prints all the data in table form (see sample run)
d. calcAllDifferences (string month[], double actual[], double average[], intsizeOfArrrays);
                       i.  calculates the monthly difference for each entry: actual - average
                      ii.  prints all the data in table form including the difference(see sample run)
e.     voiddisplaySingleMonth (string month[], double actual[], double average[]);
                       i.  asks the user for a month to display (1 – 15)
                      ii.  remember these arrays are addressed 0 – 14
                    iii.  calculates the selected month difference
                      iv.  prints the data in a single line form including the difference(see sample run)
3. the main function will
a.      Create 3 arrays…use the data from the chart below
                                                              i.     Month will hold the month as a string
                                                            ii.     Actual Rainfall will hold actual rainfall
                                                           iii.     Average Rainfallwill hold actual rainfall

b.     Calculate the size ( as shown in class) of the Actual Rainfall Array
c.      Set the cout precision and fixed decimal
d.     Welcome the user
e.     Call queryUser
f.       while loop as long as the user choice is a 1, 2, or 3
                                                              i.     Call processQuery
                                                            ii.     Call queryUser
Â
g. Thank the user for their business
4. See the sample run:





Â
Â
----------- Â ----------- H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly