Question 1 Do not actually write any C code write a step by
Question 1:
Do not actually write any C++ code, write a step by step process of how you would solve the problem
Part A: Write a process (do not create a program) that will allow the user to enter the total rainfall for each the 12 months of the year. Calculate the average monthly total, yearly total, the lowest monthly total, and the highest monthly total.
Part B: Write a process (do not create a program) that will allow the user to enter the values for 2 arrays that are in parallel. The first array will contain the names of 5 salsas: mild, medium, sweet, hot, and zesty. The second array will contain the number of jars that were sold of each type of salsa. Determine the name of the salsa which had the highest sales and the name of the salsa which had the lowest sales.
Part C: Write a process (do not create a program) that would create a function that accepts an array of integer values, a whole number n, and the number of elements in the array. The function should then determine how many values are evenly divisible by whole number n, and return the number of values greater than n to the function call.
Part D: Write a process (do not create a program) analyze the data in a two-dimensional array. The array will be a 4 by 7 array containing the daily intake of food for 4 dogs each day for a week. Determine the overall daily average intake, the minimum daily intake for each dog, and the maximum daily intake for each dog
Solution
Let me know if you need more information:-
----------------------------------------------------------
PART A:-
---------------------------------------------------------------
STEP 1: Declare an array of 12 size to store months values.
STEP 2: Just loop for 12 times to read total rainfall for individual months.
STEP 2.a) declare variable for lowest monthly total , highest monthly total , yearly total, average monthly total
STEP 2.b) for every input
check condition which is less, old or latest and take less value ---> assign to lowest monthly total
toatl the every individual months to yearly total = yearly total + latest value;
check condition which is greater , old or latest and take greate value --> assign to highest monthly total
STEP3 : after STEP 2 get the average monthly total using yearly total,/12;
STEP 5: print values. You can finish this work only with one FOR LOOP.
==================================================================
PART B :-
===================================================================
STEP1: Declare two arrays to store to input types (Hope input in order)[ 5 salsas: and 5 jars that were sold ]
STEP2:- Run for loop on second array which contains [ number of jars sold] ,Here you need to maintain index to get the names of salsas in first array for highest and lowest.
STEP3:- declare highest_sales_salsas_index , hightest_number variables and lowest_sales_salsas_index , lowsest_number variables.
to get highest_sales_salsas_index check number greateer or not if greater take that index. and copy that number to hightest_number
to get lowest_sales_salsas_index check number lower or not if lower take that index. and copy that number to lowest_number
STEP4:- Finally once you get the lowest_sales_salsas_index and highest_sales_salsas_index
just take the values on first array like
array1[lowest_sales_salsas_index],array1[highest_sales_salsas_index]
=================================================================
PARTC:-
======================================================================
STEP1:- declare function which accepts integer array,int and int
STEP2:- declare count to get the numbers which are greater and divisible by n :Now LOOP on the array which you got
calculate the modules on the element of array with n so that you will come to know that that number is divisible by n or not.
if it is divisible by n then check that number is greater then n or not if yes increment the count.
STEP3: finally return the count.
=============================================================
Part D: -
=============================================================
STEP 1: - you have to use inner loops because it is two dimentional array
STEP 2:- you have to run the outer loop for 4 times as we have only four dogs
STEP 3: -in inner loop you have to run for 7 times as it contains information for 7 days
STEP4 :- you can do the same process as in PARTA to calculate the results IN SECOND LOOP
STEP 4.a) declare variable for overall daily average intake , minimum daily intake , maximum daily intake
STEP 4.b) for every input
check condition which is less, old or latest and take less value ---> assign to minimum daily intake
toatl the every individual day to overall daily average intake = overall daily average intake + latest value;
check condition which is greater , old or latest and take greate value --> assign to maximum daily intake
STEP5 : Now you got all values for overall daily average intake, the minimum daily intake for each dog, and the maximum daily intake for each dog but if you are printing in Second loop then it is fine you will get result as required.
if not you have to store results in array.
=========================================================
Thanks

