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
Name three situations when a copy constructor executes.
Vesna [10]

Answer:

1. When an object of the class is passed (to a function) by value as an argument.

2.  When an object is constructed based on another object of the same class.

3. When compiler generates a temporary object.

Explanation:

7 0
3 years ago
Bottom-up integration testing has as it's major advantage(s) that
irakobra [83]
It's C) no stubs need to be written
8 0
3 years ago
1. The primary purpose of the human resource department in any company is to (1 point) A.) promote policies in the best interest
antoniya [11.8K]

Answer:

A.) promote policies in the best interest of both employees and the organization

Explanation:

The primary purpose of Human Resource Department in any organization is to promote policies in the best interest of both employees and the organization. They are like the heart of the company because they also deals with the staffing, compensation, retention, training, and employment of law and policies side of the business. The human resource department apart from writing of policies and procedures for hiring staffs also have plans in place to ensure that the right people that fits the job description and experience needed for a role are hired and trained for the job.

8 0
3 years ago
Consider the following C code: double balance; try { cout &lt;&lt; "Enter the balance: "; cin &gt;&gt; balance; cout &lt;&lt; en
qaws [65]

Answer:

Answer given below

Explanation:

Program:

1. double balance;

2. try{

3. cout<<"Enter the balance :";

4. cin >> balance;

5. cout<<endl;

6. if(balance < 1000.00)

7. throw balance;

8. cout<<"Leaving the try block."<<endl;

9. }

10. catch(double x){

11. cout<<" Current balance : "<<x<<endl<<"Balance must be greater than 1000.00"<<endl;;

12. }

Answer A:

If we consider the above program lines, try block represents from 2 to 9 lines.

Answer B:

If we consider the above program lines, catch block represents from 10 to 12 lines.

Answer C:

catch block parameter is x and its type is double.

Answer D:

If we consider the above program lines, line number 7 indicates throw statement.

8 0
4 years ago
Assume you have a system where you need to maintain operability even during the failing, replacing, and rebuilding of a failed d
ASHA 777 [7]

Answer:

RAID level 1 fits the criteria to yield the least amount of interference between the rebuild and ongoing disk accesses.

Explanation:

RAID system can be defined as the process in which hard drives which are connected to the system are been set up in order to help speed up the performance of a computer system disk storage which is why RAID is mostly used on servers and high performance computers system . This RAID as well helps to combines multiple physical disk drive components into various logical units for the aim of increasing system performance.

Therefore RAID level 1 fits the criteria to yield the least amount of interference between the rebuild and ongoing disk accesses. This is because the level 1 of RAID copies just the data from the failed Systems disk mirror during the rebuilding period where as the other levels of RAID copies the whole lot of content of the other disks due to the fact that RAID 1 often requires at least minimum of two physical drives because data is written simultaneously to two places in which the drives are essentially mirror images of one another in which if one fails, the other one can take over and help to provide access to the data that is been stored on that drive.

3 0
3 years ago
Other questions:
  • If a method writes to a file it should start out like (fill out the blank, what should you write after the parameters in the met
    12·1 answer
  • The four functions of a computer are
    5·1 answer
  • Which term defines a star system with two stars?
    13·2 answers
  • Nonverbal communication relies on _________________. a. multiple channels b. continuous feedback c. ambiguous interpretation d.
    9·1 answer
  • Which of the following best describes why Earth’s atmosphere can support life on Earth?
    14·1 answer
  • A __________ is a combination of software and hardware that links two different types of networks.
    14·1 answer
  • What determines how a system will work to meet the business needs defined during system investigation?
    13·1 answer
  • Which of these stamtemnst correctly descride how to adjust a imange on a slide
    8·1 answer
  • Write a program to input a number and check whether it is even or odd number
    7·1 answer
  • You need to select the text / picture /shape before you can Hyperlink.
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!