Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

to be coded in C(simple code). Having problems with the months using pointers as it prints only january instead of the other months.( perhaps a

to be coded in C(simple code). Having problems with the months using pointers as it prints only january instead of the other months.( perhaps a function needed for calling the month..Question 2) previous code at the bottomimage text in transcribedimage text in transcribed

Code below ---------------------------------

//Function Prototypes void oneFunction(double *, char ); void scaleAndLegend(); void printComparison(double *, double *, int *); int main() { // Variable for total rainfall double rainAmt2018; //initialization lists for the normal rainfall, total rainfall and months. double monthlyRainF[] = {3.1, 4.7, 4.2, 5.0, 4.0, 6.3}; double rainAmount2018[] = {5.4, 4.4, 4.1, 6.0, 5.6, 4.5}; char *month[6] = {"January", "February", "March", "April", "May", "June"}; double previousYear = 0; double currentYear = 0; //size int s = 6; //Title for the beginning of the graph printf(" Rainfall comparison for January to June 2018 "); //graph generating the rainfall comparison for (int i = 0; i  a[hRF]) { hRF = i; } } return hRF; } 

current output :

image text in transcribed

Solve this problem using pointer variables for parameter passing, where appropriate and pointer arithmetic when working with arrays. PROBLEM: Re-do the last rainfall C program you wrote to use pointers wherever possible. Fix any problems you had with the last program. Produce the EXACT output shown at the end of the document. 1. Generate a graph that compares, on a month-by-month basis, the monthly rainfall for Kamloops for the first half of 2018 (i.e. Jan-June) versus the normal (30 year average) rainfall for Kamloops for the same months. 2. In main, create the 2 data arrays using initializations lists, and also create this array char months(6"anuary", "February", "March", "April", "May", "June" h 3. Create and call ONE function to print one line of symbols. call it the first time to print the line of* call it a second time to print the line of ! Think very carefully about the parameter list for this function 4. Call a function to print the scale and the legend as shown below. 5. Call a function to find and print the total rainfall for each data set, and also the comparison of the two totals. The function will state whether 2018 was wetter, drier, or equal to a normal 6 month rainfall and by how much. 6. Call a function to determine which month in 2018 had the highest rainfall, and print the month name (using the function described in #2), the rainfall amount and how that amount compares to the normal amount for that month. Rainfall comparison for January to June 2018 January February March etc for the rest of the months une LEGEND: * normal rainfall for a given month 1-2018 rainfall for a given month Total normal rainfall was xx.x mm. Total rainfall for 2018 was W mm. 2018 was a drier year than normal bymm. (or print wetter or equal if that is appropriate) The month in 2018 with the highest rainfall was.. Run: untitled /Users/admin/Documents/untitled/cmake-build-debug/untitled Rainfall comparison for January to June 2018 January January January January January January Legend -Normal rainfall for a given month ! - 2018 rainfall for a given month Total normal rainfall was 27.30mm Total rainfall for 2018 was 30.00mm. 2018 was the drier year than normal by 2.70mm The month with the highest rainfall was April at 6.0mm Process finished with exit code 0

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions