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
In a real-world environment, changing granularity requirements might dictate changes in primary key selection, and those changes
scoray [572]

In a real-world environment, changing granularity requirements might dictate changes in primary key selection, and those changes might ultimately require the use of surrogate keys.

Explanation:

A surrogate key is a unique identity as an object or entity. It is used as an object in the database and as an entity in the modern world. Surrogate key is not a natural key hence it cannot be derived from application data.

Advantages of using surrogate key:

  • They are unique
  • They have uniform rules
  • It allows unlimited values
  • It stands the test of time
3 0
3 years ago
What's 3+3 and stop deleting my question i just wasted 41 points
bazaltina [42]

Answer:

I am pretty confident that the answer is 6

Explanation:

3+3=6

3 0
3 years ago
Read 2 more answers
Janith is creating a spreadsheet with the names, locations, dates, and costs of summer camps she is interested in attending. Wha
motikmotik

Answer:

Hyperlink camp’s web page to the document  is the right answer.

Explanation:

Adding pictures will occupy more space, activity schedules might change time to time. So considering all these factors, it is better to go for adding hyperlink of the web page in the excel. The advantage here is that, if we keep all additional data in web, we can update content any time and the client can view at any time.

Also images are displayed best in web only. If we add additional column in excel, it might not work fine for adding pictures or menu. Even if we add additional worksheet, it might not satisfy the need.

6 0
4 years ago
Binary numbers are based on powers of ___ and use ____ digits ___ through ___.Decimal numbers are based on powers of ___ and use
sertanlavr [38]
The first one is digits 
the personal use
fractions


8 0
3 years ago
Is MongoDB open source?
s2008m [1.1K]

Answer:

Yes

Explanation:

Check MongoDB on Github and you will see that it is open source.

7 0
4 years ago
Other questions:
  • What does the “Rooms” feature of FriendFeed do? Allows users with common interest to share their views and streams Allows users
    10·1 answer
  • _______ ______ is the creation of a computer program by utilizing pictorial elements. Question 36 options: A. Assembly Programmi
    7·2 answers
  • How can my computer catch a virus?
    13·1 answer
  • Check
    15·1 answer
  • __________ is software that comes hidden in free downloadable software that tracks online movements, mines the information store
    14·1 answer
  • Write an if-else statement for the following: If user_tickets is less than 5, assign 1 to num_tickets. Else, assign user_tickets
    15·1 answer
  • Some program menus are the same in every program you open. Under the File menu, all of the following are the same in every progr
    6·1 answer
  • H&amp;R Block's stated purpose is: to be the leading global consumer tax company bringing tax and related solutions to clients y
    15·1 answer
  • Chris is working with other employees on a worksheet. The other employees have made comments, but they are not visible.
    11·1 answer
  • Hey guys!
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!