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
The central processing unit​ (cpu) works in conjunction with​ ________ to perform processing.
Mama L [17]
The central processing unit​ (CPU<span>) </span>works in conjunction<span> with​ </span><span>______ to perform processing</span>
4 0
3 years ago
1. which of the following tools can be used to mesure mass. (answer = 5 +??? points)
krek1111 [17]
B. a triple-beam balance
4 0
3 years ago
Read 2 more answers
Which of the following is most likely to include technical vocabulary?
Step2247 [10]
<span>C. a scientific article</span>
6 0
3 years ago
Where can I learn how you hack?​
morpeh [17]

Answer:

www.udemy.com

5 0
2 years ago
Read 2 more answers
Two of the people most often credited with the invention of the Internet and WWW respectively are _____.
krek1111 [17]
Bob Kahn and Vint Cerf were both pioneers of the Internet, and Tim Berners-Lee was known for inventing the WWW.
7 0
3 years ago
Other questions:
  • Problems and Exercises 16 through 43 are based on the entire ("big" version) Pine Valley Furniture Company database. Note: Depen
    13·1 answer
  • EDVAC stands for? on which theory it is made on?
    15·1 answer
  • IOS jail broken or Android unrooted which is better to hack with
    6·1 answer
  • An online journal or diary you create to share your thoughts, opinions and personal news is referred to
    13·1 answer
  • What are the two basic classes of active directory objects?
    14·1 answer
  • How many strings with five or more characters can be formed from the letters in seeress?
    15·1 answer
  • You can perform an in-place upgrade to Windows 7 from both Windows XP and Windows Vista
    11·2 answers
  • If im downloading a game at 4mb/s how many minutes would it take to download 25 GB
    14·2 answers
  • How would a person giving a persuasive speech use projection to make a key point?
    9·2 answers
  • What is the difference between autofocus and autocomplete
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!