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
CAN SOMEONE PLEASE HELP ME OUT I REALLY NEED THE ANSWER!
Lemur [1.5K]

Answer:

This will work for most languages, but this is mainly for c#. Double check what language your using before putting in this answer.

          Console.WriteLine("What grade are you in?");

           int grade = Convert.ToInt32(Console.ReadLine());

           if (grade == 9)

           {

               Console.WriteLine("Freshman");

           }

           if (grade == 10)

           {

               Console.WriteLine("Sophomore");

           }

           if (grade == 11)

           {

               Console.WriteLine("Junior");

           }

           if (grade == 12)

           {

               Console.WriteLine("Senior");

           }

           if (grade < 8)

           {

               Console.WriteLine("Not in High School");

           }

Explanation:

The first line asks what grade are you in, then when the user types in the grade it saves it in a variable. We then use that variable for the conditionals. The conditional states, whatever grade level your in, it prints your high school year title. If anything is lower than 8, it will print not in high school.

6 0
2 years ago
What is the different between the patch Tool and the Headling Brush tool?​
KonstantinChe [14]

Answer:

Explanation:

The Healing Brush and Patch tools add extra features. They match the texture, transparency, lighting, and shading of the sampled area. Instead of replacing them, pixel for pixel, like the clone stamp. This causes the painted pixels to blend seamlessly into the rest of the image. Using the Healing Brush tool: 1. Select the Healing Brush tool in the toolbox.

7 0
2 years ago
Implement a function getContent() that takes as input a URL (as a string) and prints only the text data content of the associate
Reil [10]
Print is good but url is not
3 0
2 years ago
Win10如何删除自己添加的环境变量?...............
Paha777 [63]

Answer:

方法/步骤

右键单击以选择此计算机,然后有一个菜单来选择属性。

选择后,打开属性面板以找到我们的高级系统设置。

打开后,我们在系统设置下找到高级设置。

打开后,我们看到下面有一个环境变量选项。

打开后,我们在右下角看到一个删除选项。

单击删除到,在右下角后单击删除,然后单击确定的选项。 ...

本文未经授权摘自百度经验

8 0
2 years ago
Assume that cell F5 to F10 In a spreadsheet contains numeric value of salary earned by some workers and cell F12 contains the va
snow_tiger [21]

Answer:

=F5*$F$12+F5

Explanation:

If we want to increment the salaries in the cell F5, we must multiply the cell F5 by cell F12, and then we must sum that result.

If we want to drag the formula from the cell F5 to F10, we must use the dollar symbol $ to apply the same percent in our formula.

For example:

F12 = 5% = 0.05

F5 = 10,000

=F5*$F$12+F5

=10,000×0.05+10,000 = 10,500

5 0
3 years ago
Other questions:
  • Write statementsto show how finding the length of a character array char [ ] differs from finding the length of a String object
    9·1 answer
  • Hw to gain more knowledge ​
    6·1 answer
  • Which of the following is used to encrypt web application data?
    11·1 answer
  • When you start to type =av, what feature displays a list of functions and defined names?
    11·1 answer
  • In which of the following scenarios would it be best to use a for loop?
    6·1 answer
  • There are a multitude of items that Cyber Security professionals view as attack vectors but none are more prevalent and exploita
    13·1 answer
  • What's a good app that solves trigonometry problems?
    8·1 answer
  • which telecommunications service allows internet and telephone service to work over the same phone line
    13·1 answer
  • Exampels of semantic tags ?​
    7·1 answer
  • What is the second row of letters in the keyboard called?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!