Please help me! Please do this as fast as possible. All code in C++ Create a Cla
ID: 3718717 • Letter: P
Question
Please help me!
Please do this as fast as possible.
All code in C++
Create a Class named "Weather" that does the following.... There are two conditions, temperature and humidity. There should be a random number generated for humidity between 0 and 100. There should be a random number generated between -50 and 120 for temperature. There has to be a test function, where we test what happens after each test. Depending of the values for temperature and humidity, the class should display, the current weather(chilly, foggy, raining, sunny, overcast, hot, freezing, ect.)
Explanation / Answer
class weather
{
void test( int h, int t)
{
if (h < 10 )
{
cout <<"freezing";
}
if (h >10 && h < 20)
{
cout<<"chiily";
}
if(h >20 && h < 30 )
{
cout<<"foggy";
}
if(h < 40 && h > 30)
{
cout<<"overcast";
}
if(h <50 && h > 40 && t >60)
{
cout<<"raining";
}
if(h<60 && h<70)
{
cout<<"hot";
}
if(h>70)
{
cout<<"sunny";
}
}
};
temp = rand() % 120 - 50;
object.test( humidity, temp);
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.