Question: The Assignment is: Time Class Define a class to represent time. The class should provide the following methods in the public user interface: Constructor that
The Assignment is:
Time Class
Define a class to represent time. The class should provide the following methods in the public user interface: Constructor that takes one integer parameter, a time in minutes.
Constructor that takes two integer parameters, a number of hours and a number of minutes.
set method that takes two integer parameters, a number of hours and a number of minutes.
getMinutes method returns the time as all minutes.
getWholeHours method returns the number of whole hours.
getHours method returns the time in hours as a double.
getRemainingMinutes returns the number of minutes after accounting for the whole hours. For example, it time t represents 135 minutes, then t.getMinutes() is 135, t.getWholeHours() is 2,
t.getRemainingMinutes() is 15 and t.getHours() is 1.25 add method returns the calling time plus the parameter time.
Write a main program that creates several time objects and tests the various class methods.
Internally, store the time as an integer that is the time in minutes.
You can assume all times are positive.
I've laid down the framework, but I'm not really sure how to execute the the rest of the details. Here's my code so far:
#include "stdafx.h"
#include
using namespace std;
int main()
{
class Time {
public:
Time(int timeMinutes) {
}
Time(int countHours, int countMinutes) {
}
int set(int countHours, int countMinutes) {
}
int getMinutes() {
return;
}
int getWholeHours() {
return;
}
double getHours() {
return;
}
int getRemainingMinutes() {
return;
}
int add() {
return;
}
};
return 0;
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
