1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Vladimir79 [104]
1 year ago
12

in chapter 10, the class clocktype was designed to implement the time of day in a program. certain applications, in addition to

hours, minutes, and seconds, might require you to store the time zone. derive the class extclocktype from the class clocktype by adding a member variable to store the time zone called timezone. add the necessary member functions and constructors to make the class functional. also, write the definitions of the member functions and the constructors. finally, write a test program to test your class.
Computers and Technology
1 answer:
Ivan1 year ago
5 0

A program to test your class is given below:

<h3>The Program</h3>

#include <iostream>

class clockType

{

public:

void set_hour(int h);

int get_hour();

void set_minut(int m);

int get_minut();

void set_second(int s);

int get_second();

clockType() {};

clockType(int h,int m,int s)

{

 h = ((h < 0) ? 0 : (h > 23) ? 23 : h);

m = ((m < 0) ? 0 : ( m> 59) ? 59 : m);

 s = ((s< 0) ? 0 : (s > 59) ? 59 : s);

 hour = h;

 minut = m;

 second = s;

}

private:

int hour{ 0 };

int minut{ 0 };

int second{ 0 };

};

inline void clockType::set_hour(int h)

{

h = ((h < 0) ? 0 : (h > 23) ? 23 : h);

hour = h;

}

inline void clockType::set_minut(int m)

{

m = ((m < 0) ? 0 : (m > 59) ? 59 : m);

minut = m;

}

inline void clockType::set_second(int s)

{

s = ((s < 0) ? 0 : (s > 59) ? 59 : s);

second = s;

}

inline int clockType::get_minut()

{

return minut;

}

inline int clockType::get_second()

{

return second;

}

inline int clockType::get_hour()

{

return hour;

}

int main()

{

// example test program

// set time 22:54:12

clockType test(22, 54, 12);

std::cout << "Set time :" << test.get_hour() << "h" << test.get_minut() << "m" << test.get_second() << "s" << std::endl;

// set time 18:18:54

test.set_hour(18);

test.set_minut(18);

test.set_second(54);

std::cout << "Set time :" << test.get_hour() << "h" << test.get_minut() << "m" << test.get_second() << "s" << std::endl;

system("pause");

return 0;

}

Read more about programming here:

brainly.com/question/23275071

#SPJ1

You might be interested in
Which power backup method will continually provide power to a server if the power goes out during a thunderstorm
ohaa [14]

Answer:

An online UPS

Explanation:

An online uninterrupted power supply (ups) can be defined as an electronic device that is designed to supply continuous power to a load that uses alternating current (AC), through the inverter and rectifier arrangement (combination) during normal operation of the device. Thus, an online UPS through its inverter supplies continuous AC power in the event of a power failure.

Hence, an online UPS power backup method is designed and developed to continually provide power to a server (load) if there is a power outage as a result of a thunderstorm.

In conclusion, an online uninterrupted power supply (ups) guarantees a 24 hour power supply when properly installed and connected to a load or end user device such as a server.

5 0
3 years ago
jane feels listening to music at night helps her to sleep. should jane listen to music the night before a test ​
Pavel [41]

If it help her sleep than yes! Sleep helps you to stay focused during a test.

7 0
3 years ago
1 MB equals to how many GBs? Or 1 GB = how many MBs? i want to know how many MBs equal a GB, or how many GBs equal a MB; i'm get
Deffense [45]
Approximately 1,000 MBs are in a gigabyte
5 0
4 years ago
Which of the following is a trend that began during the Vietnam War and continued with the Internet?
Blizzard [7]
<span>As far as I remember, this one - a. a move toward stricter control of mass-media communications by Congress and the FCC </span><span>is a trend that began during the Vietnam War and continued with the Internet.</span>
7 0
3 years ago
Who<br> invented the term “debugging”?
Black_prince [1.1K]

Grace Murray Hopper invented it

8 0
3 years ago
Read 2 more answers
Other questions:
  • Anna is making a presentation on the top five most visited cities in her state. she wants to make sure that she does not put in
    11·2 answers
  • If a user has one column in a table and would like to make it into two columns which command should be used?
    8·2 answers
  • What process makes one group a member of another group? nesting cloning copying grouping
    8·1 answer
  • What else can Xbox do to help reduce negative online behavior? (250 minimum)
    6·1 answer
  • 7. A patent is an example of a rare and valuable resource. Indicate whether the statement is true or false and also justify it.
    14·1 answer
  • which cyber protection condition establishes a protection priority focus on critical and essential functions only
    10·1 answer
  • Most jobs in computer disciplines require which minimum level of education?
    12·2 answers
  • Please help!!
    12·2 answers
  • Which of the following could be a method for an object-oriented class called Student?
    8·1 answer
  • Why does the use of passwords put the overall security of the network in jeopardy?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!