In: Computer Science
Define a class called Goals that has the following requirements in c++:
CODE
#include<iostream>
using namespace std;
class Goals { // The
class
public:
// Access specifier
bool set(int fame,int happiness,int money) { //
Method/function defined inside the class
if(fame>=10
&& happiness>=15 && money >=12) //returns
true only if fame>=10,happiness>=15 and money=12; else
false
{
if((fame+happiness+money)>=60) //returns true only if
fame+happiness+money >= 60 otherwise false
{
return true;
}
else
{
return false;
}
}
else
{
return false;
}
}
};
int main() {
Goals obj;
int fame,happiness,money;
cout<<"enter fame happiness money
respectively"<<endl;
cin>>fame>>happiness>>money; //
Create an object of MyClass
if(obj.set(fame,happiness,money))
cout <<"result of
your goal is true"<< endl;
else
cout <<"result of
your goal is false"<< endl;
return 0;
}
OUTPUT