Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need last min help on CS homework! 13. Implement the class Tiktok discussed below. You may assume both lostream and string libraries are included, you

Need last min help on CS homework! image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
13. Implement the class Tiktok discussed below. You may assume both lostream and string libraries are included, you may not use any other libraries. There are 60 seconds in a minute, 3600 seconds in an hour, 60 minutes in an hour. The 24-hour clock better sense on what member variables you need and how you want to implement the member functions. Note that what we expect to see in the console output is not necessarily what we may want to store as member variables. convention goes from 0:0.0 to 23:59:59. Read everything before starting that way you get a t may be useful to recall that the modulus operator"%"can be used to obtain the remainder of integer division, also the + operator may be used to concatenate strings, and the function std: to_stringlint) takes an integer and returns the string equivalent of that integer, presumably for concatenating a string with an integer e Implement the default constructor which sets the initial state of Tiktok to correspond to time 0:00:00 in 24-hour clock convention (or 12:00.00 AM 12-hour clock convention) addSeconds adds the number of seconds passed into the function to Tiktok. If the amount of seconds to add is negative do nothing. There is no upper limit to the amount of seconds that can be addecd. addMinutes adds the number of minutes passed into the function to Tiktok. If the amount of minutes to add is negative do nothing. There is no upper limit to the amount of minutes that can be added. addHours adds the number of hours passed into the function to Tiktok. If the amount of hours to add is negative do nothing. There is no upper limit to the amount of hours that can be added. display24 prints to the console the time stored in Tiktok using 24-hour convention; with the following format: xx:xxxx, followed by a newline. display12 prints to the console the time stored in Tiktok using 12-hour convention. It will print AM or PM appropriately; with the following format XX:xx.Xox XM, followed by a newline Below is the class definition for Tiktok, presumably in some header file. After planning out your design declare your member variables in the private field of the class. class Tiktok f public: Tktok(); void addSeconds (int s); void addMinutes (int m); void addHours (int h) void display24) const; void display12() const; private: //TODO: Declare any member variables you think you will need. Page 4 of 8 implement the member functions of Tiktok below, assume this being done in a separate source syntactically correct as possible. file. Be as neat and a) Constructor b) addSeconds: Page 6 of ID: Below is example usage for Tiktok: void main) Tiktok tt; // Declare an instance of Tiktok tt.addHours (48); tt.display12); tt.display24); coutendl; // 12:0:0 AM // 8:0:0 tt.addMinutes (59); tt.display120: tt.display24); cout

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

Students also viewed these Databases questions