I need to know what everything is What is the mutator functi
I need to know what everything is. What is the mutator function, constructor, member functions and anything else there might be.
#include <iostream>
using namespace std;
class NumberOfDays
{
private:
double hours;
double days;
public:
NumberOfDays()
{
}
NumberOfDays(double h)
{
hours = h;
}
double getDays();
void Ask();
};
double NumberOfDays::getDays()
{
return (hours/8);
}
void NumberOfDays::Ask()
{
cout << \"Enter number of work hours: \";
cin>>hours;
cout << endl;
}
int main()
{
NumberOfDays ob;
cout << \"Enter your information\" << endl;
ob.Ask();
cout<<\"Number of days: \"<<ob.getDays();
return 0;
}
Solution
#include <iostream>
using namespace std;
class NumberOfDays
{
private:
double hours;
double days;
public:
NumberOfDays()
{
}
NumberOfDays(double h)
{
hours = h;
}
double getDays();
void Ask();
};
double NumberOfDays::getDays()
{
return (hours/8);
}
void NumberOfDays::Ask()
{
cout << \"Enter number of work hours: \";
cin>>hours;
cout << endl;
}
int main()
{
NumberOfDays ob;
cout << \"Enter your information\" << endl;
ob.Ask();
cout<<\"Number of days: \"<<ob.getDays();
return 0;
}