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);

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
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
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education