Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

IN C++ (The Time class) Design a class named Time. The class contains: (The Time class) Design a class named Time. The class contains: *

IN C++

(The Time class) Design a class named Time. The class contains:

(The Time class) Design a class named Time. The class contains:

* * The data fields hour, minute, and second that represent a time. *

A no-arg constructor that creates a Time object for the current time. * (The values of the data fields will represent the current time.) *

A constructor that constructs a Time object with a specified elapsed time since midnight, * January 1, 1970, in milliseconds. (The values of the data fields will represent this time.) *

A constructor that constructs a Time object with the specified hour, minute, and second. *

Three get fuctions for the data fields hour, minute, and second, respectively. *

A function named setTime(int elapseTime) that sets a new time for the object using the * elapsed time. For example, if the elapsed time is 555550000 milliseconds, * the hour is 10, the minute is 19, and the second is 10. * * *

Write a test program that creates two Time objects one using a no arg constructor and the other using Time(555550) and displays their hour, minute, and second in the format hour:minute:second.

And this is what I have so far:

#include

#include

class Time { public: int hour, minute, second, elapseTime;

Time() { elapseTime = 0; } Time() { int totalSecounds = time(0); } Time(int hour, int minute, int second) { elapseTime = 0; } int getHour() { return hour; } // do the getsec... void setTime(int elapseTime) {

} void time(int h, int m, int s, int e){ int currents, currentm, currenth;

m = e / 60; h = m / 60;

currents = e % 60; currentm = m % 60; currenth = h % 24; } };

int main() {

return 0; }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions