Question

In: Computer Science

Consider a class called Building. This class consists of a number of floors (numberOfFloors) for the...

Consider a class called Building. This class consists of a number of floors (numberOfFloors) for the building, a current floor for the elevator (current), a requested floor of a person waiting for the elevator (requestedFloor), and methods for constructing the building object, for moving the elevator one floor up, for moving the elevator one floor down, for requesting the elevator and for starting the elevator going. Assume that requestedFloor will be set to 0 if there are currently no requests being made (or the last request has already been fulfilled).

Refer to Class Definition Ch 04-3: What visibility modifiers would you use for the methods that move the elevator up one floor, move the elevator down one floor, that request the elevator, and that start the elevator moving?

Solutions

Expert Solution

numberOfFloors, current, requestedFloor - Variables

Answer -

moving the elevator one floor up - protected

moving the elevator one floor down - protected

requesting the elevator - public

starting the elevator going - private


Related Solutions

java code: Problem 1: Create a class called Elevator that can be moved between floors in...
java code: Problem 1: Create a class called Elevator that can be moved between floors in an N-storey building. Elevator uses a constructor to initialize the number of floors (N) in the building when the object is instantiated. Elevator also has a default constructor that creates a five storey building. The Elevator class has a termination condition that requires the elevator to be moved to the main (i.e., first) floor when the object is cleaned up. Write a finalize() method...
Consider a residential building with 5 floors with two homes at every flat each having 3...
Consider a residential building with 5 floors with two homes at every flat each having 3 m height. You want to design such a piping system that provides the same mass flow rate to all floors with same outlet pressure. Come up with such a piping system that uses only one pump for the whole installment. Draw your system, make your assumptions, and show your results with a case study.
Consider a residential building with 5 floors with two homes at every flat each having 3...
Consider a residential building with 5 floors with two homes at every flat each having 3 m height. You want to design such a piping system that provides the same mass flow rate to all floors with same outlet pressure. Come up with such a piping system that uses only one pump for the whole installment. Draw your system, make your assumptions, and show your results with a case study. (Hint: Minor losses may help! You may check pipe sizes...
Define a class called Rational for rational numbers. Arational number is a number that can...
Define a class called Rational for rational numbers. A rational number is a number that can be represented as the quotient of two integers. For example, /2, 3/4, 64/2, and so forth are all rational numbers.Represent rational numbers as two private values of type int, numfor the numerator and den for the denominator. The class has a default constructor with default values (num = 0,den = 1), a copy constructor, an assignment operator and three friend functions for operator overloading...
Structured Cabling is defined as building or campus telecommunications cabling infrastructure that consists of a number...
Structured Cabling is defined as building or campus telecommunications cabling infrastructure that consists of a number of standardized smaller elements (hence structured) called subsystems. With the aid of detailed and fully labelled diagrams, describe how you would use the principles of structured cabling to setup a professional computer network for the user who posted their request online (…see below). We have a small three-story building. My husband is a small-business owner. We have decided to network all three floors of...
Calculate the firewater demand in (m3/min) for a building having 25 floors including basement. Building is...
Calculate the firewater demand in (m3/min) for a building having 25 floors including basement. Building is constructed with non-combustible construction material and serving total population of 1400. Assume area of each floor as 9800 ft2. Using following formulas:                                 [5 Marks] a). Insurance Services Office Formula b). Equation for National Board of Fire Underwriters c). If fire water demand is required for 4 hours calculate the volume of water storage tank in m3 (For Part b only) Instructions: Find the values...
Design an elevator control system for an 8 floors building, draw the logic diagram, and illustrate...
Design an elevator control system for an 8 floors building, draw the logic diagram, and illustrate the system with the following situations: 1. The car is on the ground floor, John Doe wants to go from ground floor to 7th floor; 2. The car is on 8th floor, John Doe wants to go from 6th floor to the ground floor; 3. The car is moving up from 4th floor to 7th floor, John Doe wants to go from 6th floor...
The winning time for the 2005 annual race up 86 floors of the Empire state building...
The winning time for the 2005 annual race up 86 floors of the Empire state building was 10 min and 49 seconds. The winner's mass was 60 Kg. A) if each floor was 3.7 m high, what was the winners change in gravitational potential energy? B) If the efficiency in climbing stairs is 25%, what total energy did the winner expend during the race? C)How many food Calories did the winner burn in the race D) Of those calories, how...
Create a class called RandomGuess. In this game, generate and store a random number between 1...
Create a class called RandomGuess. In this game, generate and store a random number between 1 and 100. Then, continuously (in a loop): Ask the user to enter a number between 1 and 100 Let the user know if the guess is high or low, until the user enters the correct value If the user enters the correct value, then display a count of the number of attempts it took and exit
Create a class called RandomWhen. The program must continuously generate a random number between 1 and...
Create a class called RandomWhen. The program must continuously generate a random number between 1 and 100 inclusive. The program must stop when the number 1 is generated, and the loop iteration will be printed. Run the program 3 different times. Sample output: It took ## iterations to generate a 1. It took ## iterations to generate a 1. It took # iterations to generate a 1.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT