TIME CLASS (Language: C++) - Write a time class named timeClass  - Write code to demonstrate that it works - The timeclass class will be named timeClass - The class must have these 3 constructors: #1) timeClass(); #2) timeClass(int h, int  m, int s); #3) timeClass (string timeIn); - The string constructor must be capable of being separated by colons or blanks time in the 24-hour format: example    23:11:07 or 9:4:9 or 11 31 27 - DO NOT use some system functions for this assignment. You must write the code.  - Yes, you can convert from string to integer stoi ( string).    - In addition to the constructors, you should supply a set of getters (Accessors) getH, getM getS - In addition to that, add mutators that allow the individual setting of Hours, Minutes and Seconds: setH(int),    setM ( int )     setS( int ) Include this setter ( Mutator)   setTime( int NumSeconds); - So if I call setTime( 7673) you would know that that is:    -- hours,   -- minutes and -- seconds seconds = 53    7673 % 60 minutes with hours = 7673 / 60  = 127 minutes = 127 % 60   = 7 hours 127/60   = 2.  ( double check     2 * 3600  + 7 * 60 + 53 = 7673 )  - getStr () that returns a string in 12-hour format.  including the AM/PM designator  ( 9:04:07 AM) - getStr24 () that returns a string of the time in 24-hour format (22:57:31 )  - You may store the time as a single integer that is seconds from midnight or you may store the time as hours, minutes, and seconds. But do not duplicate the time.  - Include an add function: add ( int seconds) will add the number of seconds to the current time in the object.   If the sum rolls over stop at 24 hours 60 minutes 60 seconds.  Seconds could be from 0 to ( 24 * 60 * 60). = = = = = = = = = = = = = = = = = = = = = = = = = =  = = = = = = = =  In Total you should have at least these member functions in your timeClass: I count 12 functions.  : 3 constructors           timeClass();           timeClass(int h, int m, int s);           timeClass (string timeIn); Getters:           int getH,           int getM           int getS           int getStr ()           string getStr24 () Mutators:           setH(int),           setM ( int )           setS( int )           setTime( int NumSeconds);

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter10: Introduction To Inheritance
Section: Chapter Questions
Problem 6RQ
icon
Related questions
Question

TIME CLASS (Language: C++)

- Write a time class named timeClass 

- Write code to demonstrate that it works

- The timeclass class will be named timeClass

- The class must have these 3 constructors:

#1) timeClass();

#2) timeClass(int h, int  m, int s);

#3) timeClass (string timeIn);

- The string constructor must be capable of being separated by colons or blanks time in the 24-hour format:

example    23:11:07 or 9:4:9 or 11 31 27

DO NOT use some system functions for this assignment. You must write the code. 

- Yes, you can convert from string to integer stoi ( string).   

- In addition to the constructors, you should supply a set of getters (Accessors) getH, getM getS

- In addition to that, add mutators that allow the individual setting of Hours, Minutes and Seconds:

setH(int),    setM ( int )     setS( int )

Include this setter ( Mutator)   setTime( int NumSeconds);

So if I call setTime( 7673) you would know that that is:    -- hours,   -- minutes and -- seconds

seconds = 53    7673 % 60

minutes with hours = 7673 / 60  = 127

minutes = 127 % 60   = 7

hours 127/60   = 2. 

( double check     2 * 3600  + 7 * 60 + 53 = 7673 ) 

- getStr () that returns a string in 12-hour format.  including the AM/PM designator  ( 9:04:07 AM)

- getStr24 () that returns a string of the time in 24-hour format (22:57:31 ) 

- You may store the time as a single integer that is seconds from midnight or you may store the time as hours, minutes, and seconds. But do not duplicate the time. 

- Include an add function: add ( int seconds) will add the number of seconds to the current time in the object.   If the sum rolls over stop at 24 hours 60 minutes 60 seconds.  Seconds could be from 0 to ( 24 * 60 * 60).

= = = = = = = = = = = = = = = = = = = = = = = = = =  = = = = = = = = 

In Total you should have at least these member functions in your timeClass:

I count 12 functions. 

:

3 constructors

          timeClass();
          timeClass(int h, int m, int s);
          timeClass (string timeIn);

Getters:

          int getH,

          int getM

          int getS

          int getStr ()

          string getStr24 ()

Mutators:

          setH(int),

          setM ( int )

          setS( int )

          setTime( int NumSeconds);

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Data members
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning