[Solved] : Question 128386

The moon sighting is based on the age of the moon. Age is determined with day and hours. If the age of moon is less than 24hour its hard to sight. The user can input the age in hours or both using constructors. If date is given in both days and hours through 2Arg constructor then it must be converted into hours, within the constructor using overloaded decrement (–)operator. Write a C++ class Age using OOP concepts to determine that either the moon can be sighted or not with respect to age of the moon in hours. Main function is given below for your help (changing not allowed below)
int main()
{
Age A1(9);
if(A1<24)
cout<< “nMoon cannot Sighted”;
else
cout<<“n Moon Sighted”;
//Object via 2-Arg Constructor, first arg is day and second arg is hours
Age A3(1,9); //Overloaded Decrement operator is called in this constructor
//which converts days and hours in hours
if(A3<24)
cout<< “nMoon cannot Sighted”;
else
cout<<“n Moon Sighted”;
return 0;
}


Expert Answer


Answer to : Question 128386

Leave a Comment

About

We are the best freelance writing portal. Looking for online writing, editing or proofreading jobs? We have plenty of writing assignments to handle.

Quick Links

Browse Solutions

Place Order

About Us

× How can I help you?