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
What is the destination ip address when an ipv4 host sends a dhcpdiscover message?
hjlf

The destination ip address when an ipv4 host sends a DHCPDISCOVER message Because a DHCP client does not have a valid IPv4 address, it must use a broadcast IP address of 255.255. 255.255 as the destination address to communicate with the DHCP server.

<h3>What does the DHCP server do when it receives the Dhcpdiscover message?</h3>

When the lease has expired, the client must start over with the DHCPDISCOVER process. The client ends the lease by sending a DHCPRELEASE message to the DHCP server. The server will then return the client's IP address to the available address pool.

<h3>What is a Dhcpdiscover message?</h3>

The DHCPDISCOVER message contains an identifier unique to the client (typically the MAC address). The message might also contain other requests, such as requested options (for example, subnet mask, domain name server, domain name, or static route). The message is sent out as a broadcast.

To learn more about DHCPDISCOVER, refer

brainly.com/question/14407739

#SPJ4

8 0
1 year ago
Java and Python are considered rapid development programming languages?<br><br> True<br><br> False
Zepler [3.9K]
That is true because Java was considered a rapid development programming language
8 0
3 years ago
Read 2 more answers
Steps of booting a computer
Lostsunrise [7]
Steps of Booting
The Startup. It is the first step that involves switching the power ON. ...
BIOS: Power On Self Test. It is an initial test performed by the BIOS. ...
Loading of OS. In this step, the operating system is loaded into the main memory. ...
System Configuration. ...
Loading System Utilities. ...
User Authentication.
8 0
2 years ago
What does a "swivel chair" work task involve?
nadezda [96]

Answer:

An employee literally swings from application to application to accomplish the laborious task of manually copying information from one application, validating it, and pasting it in another application. In applying human judgment and decision making: Entering data multiple times into different applications. Ensure that complex information obtained from an application is accurate. Communicate physicallly with a group of people simultaneously.

Explanation:

4 0
2 years ago
Construct a group frequency distribution for the following data: 18, 22, 15, 12, 18, 22, 22, 24, 21, 19, 13, 13, 17, 18, 20, 12,
Y_Kistochka [10]

Answer:

uhebcuwcih

Explanation:

iqic c .j .c h de c veo  dnjen jndc j .ececiibbec .cecinineijc    

4 0
3 years ago
Read 2 more answers
Other questions:
  • . Electricians will sometimes call ______ "disconnects" or a "disconnecting means."
    12·1 answer
  • Please list the computer data hierarchy from bit to database
    6·1 answer
  • Elizabeth works for a local restaurant At the end of her shift, she is required
    15·2 answers
  • A USB zipper drive is a small data storage device that plugs into a computer's USB port.
    14·1 answer
  • MegaCorp MegaCorp is large manufacturing firm that operates 5 factories in Dallas, 4 factories in Los Angeles, and 5 factories i
    13·1 answer
  • What do the buttons on the paste options menu do
    11·1 answer
  • How do I get the bot token for discord? (scripting etc)
    5·1 answer
  • Write the difference between left-sentential form and <br> right-sentential form
    13·1 answer
  • What is the expression for the resultant value of three capacitance where C1 connected in parallel​
    11·1 answer
  • If you want to remove the autocorrect options button from the screen, you can press the ____ key.
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!