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 line in the following program will cause a compiler error?
Viktor [21]

Answer:

The answer is "Option A".

Explanation:  

  • In the given C++ Language program on line 8 compile-time error will occur, because in the code the conditional statement is used. In if block, we check two conditions together, which is the number variable value is greater than equal to 0 and check less than equal to 100.  
  • In this condition statement, a AND operator is used that execute when both condition is true, but in the last condition, we do not define a variable name that, checks value. That's why the program will give an error on line 8.
3 0
3 years ago
Circuitry can be either basic or ___________.
Sonja [21]
I think it would be A. Ohm's law.
hope this helps.
6 0
3 years ago
Read 2 more answers
(in PYTHON) Write a function in REPL.it that uses three parameters, and squares the first, calculates mod 5 of the second parame
tatiyna

Answer:

I wrote this myself, it should be working. I think this is what the instructions were looking for.

The code below should return

Squared: 1296  

Mod: 0        

Quadrupled: 16

Explanation:

def threeParams(squared, mod, quadruples):

   array = [squared, mod, quadruples]

   array[0] = squared ** 2

   array[1] = mod % 5

   array[2] = quadruples * 4

   return array

valueArr = threeParams(36, 15, 4)

print(f"Squared: {valueArr[0]}\nMod: {valueArr[1]}\nQuadrupled: {valueArr[2]}")

4 0
2 years ago
Write a program that uses a scanner to report some statistics about words in an input sentence ( see Section 7.8). The outputs s
Alla [95]

import java.util.Scanner;

public class JavaApplication77 {

   

   public static void main(String[] args) {

       Scanner scan = new Scanner(System.in);

       System.out.println("Enter a sentence:");

       String sentence = scan.nextLine();

       String [] arr = new String[sentence.length()];

       arr = sentence.split(" ");

       System.out.println("There are "+arr.length+" words in the sentence.");

       int count = 0;

       for(int i = 0; i < arr.length; i++){

           count += arr[i].length();

       }

       System.out.println("The average length of a word in your sentence is "+(count/arr.length)+" characters");

       count = 0;

       System.out.println("Your sentence is "+sentence.length()+" characters long.");

       

   }

   

}

For the length of a sentence, I included spaces as characters but I did not do this for the length of a word. I hope this helps!

8 0
3 years ago
Please help me i will award brainliest
Sergio [31]

Answer: It would be option C.

Explanation: The file name is invalid, so therefore it would make sense to rename the most recent version correctly.

8 0
3 years ago
Other questions:
  • What is the name of the file manager in microsoft windows?
    9·2 answers
  • Which statement accurately describes DTP programs?
    11·1 answer
  • A Unit of information containing the objects position, rotation, and scale values is called:
    13·1 answer
  • How is the go button on m computer?
    10·1 answer
  • Hi! This is python coding. Please don't take advantage, actually, answer!
    11·1 answer
  • Write a for loop with a range function that prints the following output. Name the target variable number. 0 1 2 3 4 5
    6·1 answer
  • Question 1 (1 point)
    9·1 answer
  • simplify the expression below and state the value of m for which the simplified expression is not defined 2m² + m - 15/ m² - 9​
    5·1 answer
  • Given a list of syntax errors from a compiler, a programmer should focus attention on which error(s), before recompiling?
    14·1 answer
  • you manage a network that has multiple internal subnets. you connect a workstation to the 192.168.1.0/24 subnet. this workstatio
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!