Create a class named weather report that holds a daily weather report with data
members day_of_month,hightemp,lowtemp,amount_rain and amount_snow. The
constructor initializes the fields with default values: 99 for day_of_month, 999 for
hightemp,-999 for low emp and 0 for amount_rain and amount_snow. Include a
function that prompts the user and sets values for each field so that you can override the
default values. Write a program that creates a monthly report.
Hey guys I am new to C++ and I want to make the program that does this. Could you tell me how I should go about it, the skeleton of the program and a few hints as to how I should go about it?
Create a weatherReport class.
Give it data members day_of_month,hightemp,lowtemp,amount_rain and amount_snow.
Give it a constructor that sets default values.
Give it a function to get values from user for the data members.
If you're working inside of your class, access them as normal. For outside of the class, you need setter/getter functions (also known as accessor functions).
#include <iostream>
class dataStore
{
public:
int x;
dataStore();
};
dataStore::dataStore()
{
x = 7; // Set x to default value
}
int main()
{
dataStore a;
std::cout << a.x << std::endl;
return 0;
}
What if I make int x private in the dataStore class? Could you give me an example of the setter/getter functions please? Thanks a lot! Appreciate the help :)