Write a program that calculates the average rainfall for three months. For each
ID: 3638942 • Letter: W
Question
Write a program that calculates the average rainfall for three months. For each of the three months, the program should ask the user to enter the name of the Month followed by the amount of rain (in inches) that fell in that month. The program should then calculate the average rainfall. Format the average value to be in fixed-point notation, with three decimal places of precision, and be sure the decimal point is always displayed.Explanation / Answer
include #include class rain { float inch1,inch2,inch3; char m1[10],m2[10],m3[10]; public: void getdata(); void putdata(); }; inline void rain::getdata() { coutm1>>m2>>m3; coutinch1>>inch2>>inch3; } inline void rain::putdata() { float avg=(inch1+inch2+inch3)/3; coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.