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
Montano1993 [528]
2 years ago
13

1. Write a class for time objects that store three integer values for hour, minute, and second. Also, write a program to test th

e functionality of your class. Make sure it does all of the following:
Create time objects with no values (default)

Create time objects with all three values (hour, minute, second)

Change the value for hour

Display military time

Display standard time

2. Define a class for an elevator that only services three floors. Your class must store variables for CurrentFloor (int), GoingUp (bool), and GoingDown (bool). Write a default constructor function for the class and two member functions: goUp() and goDown(). Write an elevator test program. Have the program execute the following steps using the methods in the class:

Start on the first floor.

Go to the second floor (don’t forget to update the Boolean variable GoingUp).

Go to the third floor

Go to the fourth floor (or at least try to)

Go back to the second floor

Go back to the first floor
Computers and Technology
1 answer:
Alla [95]2 years ago
6 0

Answer:

1.

class TIME

{

int hour , min , sec ;

public :

TIME()

{

hour=min=sec=0;

}

TIME( int h , int m , int s )

{

hour = h;

min = m;

sec = s;

}

void change ( int Hour)

{

hour = Hour;

}

void stdtime()

{

if(hour>12)

cout<<"The Standard time is"<<(hour-12)<<":"<<min<<":"<<sec<<"P.M\n";

else

cout<<"The Standard time is"<<hour<<":"<<min<<":"<<sec<<"A.M\n";

}

void miltime()

{

cout<<"The Military time is"<<hour<<":"<<min<<":"<<sec<<" hours\n";

}

};

void main()

{

TIME A , B(13,25,30);

A .stdtime();

A.change(23);

A.miltime();

B.stdtime();

B.change(9);

B.miltime();

}

2.

class elevator

{

int CurrentFloor;

int GoingUp;

int GoingDown;

public:

elevator()

{

CurrentFloor=0;

GoingUp=1;

GoingDown=-1;

}

elevator(int floor)

{

CurrentFloor=floor;

GoingUp=1;

GoingDown=-1;

}

void goUp(int y)

{

if( CurrentFloor>3)

cout<<"\nNO MORE FLOORS\n";

else

CurrentFloor=CurrentFloor+y*GoingUp;

}

void goDown(int x)

{

if(CurrentFloor<0)

cout<<"\nNO MORE FLOORS";

else

CurrentFloor=CurrentFloor+x*GoingDown;

}

};

void main()

{

elevator A(1);

A.goUp(1);

A.goUp(1);

A.goUp(1);

A.goDown(1);

A.goDown(1);

}

You might be interested in
6. When working with a file,
likoan [24]

Answer:

When working with a file, <u>stabilize</u> the blade in a vis or against a solid surface such as a work bench to avoid injury and to ensure an even stroke

Explanation:

The file can be used to sharpen a blade to increase the effectiveness of the blade. In order to properly sharpen a file in a safe manner, the blades to be sharpen, which ae usually relatively flexible as compared to the file, should be  made stable during the repetitive forward and backward notion of the file, for safety, to avoid being injured by the recoil of the blade, and also to ensure that the stroke is evenly applied to the blade.

4 0
2 years ago
What properties make it suitable to be used for musical instruments?
Stolb23 [73]
<h2>Many properties can be listed out viz. durability, quality, the sound that it produces also depends on the material that is used, etc.</h2>

Explanation:

1. If you take wood then I would say maple, rosewood, cedar, walnut can be used to make "String instruments".

Reason:

The wood that we choose should be perfect and should give long-life to use the instrument.

2. If we consider about strings, then I would suggest that the material that you choose should be "ductile and hard".

Reason:

Thin wires can be drawn.

3. In case of Brass, it should be "malleable metal", so that the outcome of the instrument will satisfy the need.

7 0
3 years ago
What is the purpose behind the Three Phase Commit? It improves upon the two phased commit by requiring that locks be acquired at
Ray Of Light [21]
The answer is a) It improves upon the two-phased commit by requiring that locks be acquired at the start of a transaction.

Reason: The 3PC is an extension or you can say developed from 2PC that avoids blocking of an operation. It just ensures that first n sites have intended to commit a transaction that means it acquires commits or locks before the start of any transaction to avoid any blocking.

Option b) is wrong as it does not allow coordination, it just let all the other sites do their transaction if any other site is blocked, so no coordination is there between sites that they will wait till their coordinator is corrected.

Option c) is wrong as lock operations are shared between other connections as when their coordinator fails, the new coordinator agrees to the old coordinator that they had shared locks before and they can start their transaction.

Option d) is wrong as option a) is correct.

If you like the answer, please upvote.
4 0
2 years ago
How to add a while loop? here's my code
Jet001 [13]

To add while loop in python language, the use of syntax is to be brought into the effect.

<h3>What is a while loop?</h3>

A while loop can be referred to as an expression of code-blocks being true to their cores. Until the blocks of the code are not proved to be true, the loop continues.

In order to add such while loop to your code, one needs to use the syntax function in python to prove the true and correctness of the code blocks.

Hence, the procedure to add while loop has been aforementioned.

Learn more about a while loop here:

brainly.com/question/15690925

#SPJ1

3 0
2 years ago
How do you write 124.59 in expanded form?
scZoUnD [109]
124.59 in expanded form is:

100 + 20 + 4 + 0.5 + 0.09
8 0
2 years ago
Read 2 more answers
Other questions:
  • In Linux, when logged in as a normal user with root privileges, which command must precede the apt-get command in the command li
    13·1 answer
  • Which of the following are true statements about collisions in hashing? Linear probing can cause secondary collisions. Higher sp
    6·1 answer
  • A 2-dimensional 3x3 array of ints, has been created and assigned to tictactoe. Write an expression whose value is true if the el
    10·1 answer
  • A) What is the maximum value that can be represented as an unsigned n-bit binary integer?
    13·1 answer
  • --------------------is a host that runs software to provide information, such as web content, to other hosts.
    9·1 answer
  • What is the difference between simple and complex waveforms?
    10·1 answer
  • What year did buck tooth bob become famous
    11·2 answers
  • The Fibonacci sequence begins with 0 and then 1 follows. All subsequent values are the sumof the previous two, for example: 0, 1
    11·1 answer
  • How are mathematics and computer science similar? Discuss any connections between numbers, logic, and other elements.
    14·1 answer
  • Advantages and disadvantages of algorithm​
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!