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
If an engine has four cylinders and a total of 16 valves, how many valves would each cylinder have?
wel
4 because 4 x 4=16. Easy. I like to think of it as multiplication.
4 0
3 years ago
How do individuals differ in terms of their ability to process information?
Alla [95]
Oh that is easy first they differ the therms of their ability and that helps them process the information ( sorry for doing that lol)
5 0
3 years ago
What do you do to prevent damage to your tools
scoundrel [369]

use them correctly and store them in a dry place, tools made of steel can rust in prolonged exposure to a damp or humid environment

6 0
3 years ago
According to the author, "U.S. Security strategy and U.S. Identity towards Internet governance are all anchored in the idea of f
Shalnov [3]

Answer:

The answer

Explanation:

4 0
3 years ago
Anyone have any ideas how to work this out x
Kobotan [32]

Answer:

1.5 μs

Explanation:

time = distance / speed

if your cabinet is 300 m away, the time it takes is:

300 [m] / 200 000 x 10³ [m/s] = 1.5 x 10⁻⁶ s = 1.5 μs

4 0
3 years ago
Other questions:
  • Which statement prints "hi" on the screen?
    5·2 answers
  • What is the output of the following C++ program?
    15·1 answer
  • The algorithm credited to Euclid for easily finding the greatest common divisor of two integers has broad significance in crypto
    11·1 answer
  • Which activity does not allow a person to perform any work while at the shop
    10·1 answer
  • Encapsulation is the process of “packaging” information prior to transmitting it from one location to another. true or false
    14·1 answer
  • TRUE OR FALSE! HELP!!
    13·1 answer
  • Which words in the sentence make up the adjective phrase? Which word does the adjective phrase modify? The farmer delivers five
    15·1 answer
  • Digital printing is not suitable for printing what
    11·1 answer
  • According to the presentation, integrity and ethics are particularly important for careers in which of the following pathways?
    5·1 answer
  • There are two main types of hard drive available to a computer. State what they are and describe their use.
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!