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]
3 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]3 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
An 8x16 font isstored in _________________ bytes.<br> ? 8<br> ? 16<br> ? 4<br> ? 20
stiv31 [10]

Answer:

The answer to this question is 16 bytes.

Explanation:

8x16 font means it contains 16 rows by 8 columns of 1-bit pixel ( picture element ).

rows=16.

columns=8.

8 bit = 1 byte.

8x1 = 1 byte.

8x16 = 16 bytes.

So 8x16 font size requires 16 bytes of data to store a character.Hence we conclude that the answer is 16 bytes.

8 0
3 years ago
Which of these is a cultural form? A. Art B. Food C. Clothes D. All of the above
wel
D. All of the above


Sorry If Wrong
4 0
4 years ago
Read 2 more answers
How would you classify the earliest historical examples of STEM discoveries provided in this lesson?
Readme [11.4K]
MATHEMATICAL DISCOVERIES
4 0
4 years ago
Read 2 more answers
What does every shot have with regards to depth?
djyliett [7]

This can be used to capture a larger area of acceptably sharp images. This can also be referred to as a deep depth of field, and some cinematographers will simply use the term “depth” to describe shots with a large DOF. It can also be referred to as deep focus.
5 0
3 years ago
Suppose you are implementing the address book feature for a cellphone. The address book needs to be kept sorted by person’s last
NemiM [27]

Answer:

Sorted linked list

Explanation:

  • A sorted linked list can be used for sorting the last name and support fast access while queried by the last name.
  • The hash table cannot be used because it could have a problem if there would be more buckets to handle than the expected.
  • The binary search table is implemented as the hash table hence both will give the same results.
8 0
3 years ago
Other questions:
  • What does ip mean? internet protocol address internet program internet process (system software) internet prescience?
    6·1 answer
  • Patrick Stafford's article argues that the growth of mobile phone usage "has given developers the ability to great robust and en
    7·1 answer
  • How can you say that a computer is a versatile machine?​
    7·1 answer
  • How to help it automation with python professional certificate?
    10·1 answer
  • What is the complete predicate in the sentence below? Looking up from his computer monitor, Jason mopped his brow, exhaled sharp
    12·1 answer
  • What are the values of a[k] and a[k+1] after code corresponding to the following pseudocode runs?
    9·2 answers
  • What does Falstaff do to protect himself in battle? ​
    15·1 answer
  • HURRY- I’ll give 15 points and brainliest answer!!
    10·2 answers
  • Why are response tests more difficult for some students? What can you do to make them easier for yourself?
    10·2 answers
  • How does our behavior change when we know we're being watched?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!