PLEASE COMPLETE THE FOLLOWING PROMPT IN C++ , THANK YOU! USE THIS FOLLOWING CODE WHEN SOLVING FOR THE SOLUTION! IT IS PA

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

PLEASE COMPLETE THE FOLLOWING PROMPT IN C++ , THANK YOU! USE THIS FOLLOWING CODE WHEN SOLVING FOR THE SOLUTION! IT IS PA

Post by answerhappygod »

PLEASE COMPLETE THE FOLLOWING PROMPT IN C++ , THANK
YOU!
Please Complete The Following Prompt In C Thank You Use This Following Code When Solving For The Solution It Is Pa 1
Please Complete The Following Prompt In C Thank You Use This Following Code When Solving For The Solution It Is Pa 1 (109.47 KiB) Viewed 34 times
USE THIS FOLLOWING CODE WHEN SOLVING FOR THE SOLUTION!
IT IS PART OF THE QUESTION.
#include <iostream>
using namespace std;
enum class Units {IMPERIAL, METRIC};
struct WxObservation {
string date;
string time;
string zipcode;
int temperature;
int humidity;
double visibility;
Units unit;
};
void displayWeatherObservation(const WxObservation &wo);
int main() {
WxObservation observation;
observation.date = "1/25/2022";
observation.time = "11:00 PDT";
observation.zipcode = "92056";
observation.temperature = 75;
observation.humidity = 51;
observation.visibility = 7.0;
observation.unit = Units::IMPERIAL;
displayWeatherObservation(observation);

return EXIT_SUCCESS;
}
void displayWeatherObservation(const WxObservation &wo)
{
string strDistance;
string strTemp;

if (wo.unit == Units::IMPERIAL) {
strDistance = "miles";
strTemp = "F";
}
cout << "On " << wo.date << " @ " <<
wo.time
<< ", zipcode " << wo.zipcode << " experience a
temperature of "
<< wo.temperature << " " << strTemp << ",
humidity "
<< wo.humidity << "% and visibility of " <<
wo.visibility
<< " " << strDistance << "." << endl;
}
In this assignment, we will be declaring a structure (struct) to record weather observations. In order to accomplish this task, please create a struct named WxObservation, with the following data: • string date (e.g. "MM/DD/YYYY") • string time (e.g. "11:00 PDT") • string zipcode (e.g. 92056) • int temperature • int humidity • double visibility (e.g. 7.0) • enum for units (either IMPERIAL or METRIC) Demonstrate the structure in a complete program (e.g. in the int main() function) by creating a WeatherObservation variable, initialized to typical Costa Mesa readings: date = "1/25/2022" time = "11:00 PDT" zipcode = "92056" temperature = 75 humidity = 51 visibility = 7.0 units = IMPERIAL Then create a function called void displayWeatherObservation(const WxObservation &wo) which displays the structure to the console using cout, in the following format: For Imperial Measurements: On 1/25/2018 @ 11:00 PDT, zipcode 92056 experienced a temperature of 75 degrees F, humidity 51% and visibility of 7.0 miles. For Metric Measurements: On 1/25/2018 @ 11:00 PDT, zipcode 92056 experienced a temperature of 24 degrees C, humidity 51% and visibility of 11.3 km. Below are two sample transactions: With imperial measurements: Welcome to the weather program. On 1/25/2022 @ 11:00 PDT, zipcode 92056 experienced a temperature of 75 degrees F, humidity 51% and a visibility of 7.0 miles. With metric measurements: Welcome to the weather program. On 1/25/2022 @ 11:00 PDT, zipcode 92056 experienced a temperature of 24 degrees C, humidity 51% and a visibility of 11.3 km. *Note: turn in screenshot of both imperial and metric
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply