Question: Define a private helper function called ConvertToMinutes() that converts the data member hours to minutes and returns an integer. Ex: If the input is 540,

Define a private helper function called ConvertToMinutes() that converts the data member hours to minutes and returns an integer.

Ex: If the input is 540, then the output is:

32400 minutes 

Note: The equation to convert from hours to minutes is: minutes = hours * 60

#include #include #include using namespace std;

class Time { public: void SetHours(int timeHours); int GetHours() const; void PrintInMinutes(); private: int hours; int ConvertToMinutes(); };

void Time::SetHours(int timeHours) { hours = timeHours; }

int Time::GetHours() const { return hours; }

/* Your code goes here */

void Time::PrintInMinutes() { cout << fixed << setprecision(1) << ConvertToMinutes() << " minutes" << endl; }

int main() { Time time1; int inputHours;

cin >> inputHours; time1.SetHours(inputHours);

time1.PrintInMinutes();

return 0; }

c++ please please make it correct

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!