Question: Write the program in C++ PART 1. Save your program in this section to source file called labPart1.cpp a) Declare a struct called TempScale with

Write the program in C++

PART 1.

Save your program in this section to source file called labPart1.cpp

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 program.

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 variable r (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.

PART 2

2) Update your program from part (1) as follows and save your program to labPart2.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 inFile 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,

// 37 44.0 32 0

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 (2) above by calling each function.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!