Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1) Save your program in this section to source file called lab5-1-yourname.cpp to submit. a) Declare a struct called TempScale with members Fahrenheit (double) and
1) Save your program in this section to source file called lab5-1-yourname.cpp to submit. a) Declare a struct called TempScale with members Fahrenheit (double) and celcuis (double) in your program. b) Declare a struct called Reading with members windspeed (int), humidity (double), temperature (TempScale) in your progran c) In your main function, create a new variable called r of type Reading. That is add the line Reading r; to your main function. We have the following reading values. Store these values in variabler (you can hard code the values in your program). Wind Speed: 37 mph Humidity: 44 Fahrenheit temperature: 32 degrees Celsius temperature: 0 degrees d) Add code to your main function to print the values stored in variable to the screen. 2) Update your program from part (1) as follows and save your program to lab5-2-yourname.cpp to submit. a) Your job is first to add 5 functions to your program. The headers of the functions are provided below, you must provide the definition (implementation) of each function. Note that you are not allowed to change the headers of the functions. // This function will get a Reading information interactively from the user and save and returned the Reading information Reading getReadingInfo_ver1(); // This function will get a Reading information interactively from the user and will save Reading information in the reference parameter r void getReadingInfo_ver2 (Reading &r); // this function will print the given Reading information to the screen void printReadingInfo (const Reading &r); // this function will print (save) a Reading information stored in r to the output text file outFile void saveReadingInfo (ofstream &outFile, const Reading &r); // this function will get (read) a single Reading information from the input text file in File to reference variable r // You can assume that the input text file has lines where each line has 4 values // separated by SPACE character showing Wind Speed, Humidity, Fahrenheit and Celcius temperatures for the Reading. For instance, 1/ 37 44.0 320 void readReadingInfo (ifstream &iFile, Reading &r); b) Next, you must update your main function to show the use of each of the functions you wrote in part (2a) above by calling each function
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started