subject

1. define class elevator. for simplicity, we do not consider property like capacity (or weight limit), door (open or close), or status (running, maintenance, alarm). (a) data members of an elevator can be as follows, they are all ints. currentfloor, basefloor, and topfloor; (b) define constructors for elevator class. a default constructor setting basefloor to be 1, and topfloor to be 6, and currentfloor to be1. define an non-default constructor public elevator(int currentfloor, int basefloor, int topfloor), where topfloor should be at least 2, basefloor should be smaller than topfloor, and currentfloor is somewhere between basefloor and topfloor. (c) define method up with a given parameter numfloors (an int). if numfloors is positive, then move that many floors up from the currentfloor, update value for currentfloor. note that after you run this method, currentfloor cannot be bigger than topfloor.(d) define method down with a given parameter numfloors (an int). if numfloors is positive, then move that many floors down from the currentfloor, update value for currentfloor. note that after you run this method, currentfloor cannot be smaller than the basefloor.(e) define a getter for each data member. (f) no need to define other method.2. define passenger class. it takes data members: currentfloor and targetfloor. both are ints.(a) define constructor of passengers. this constructor takes two int parameters, use them to initialize the corresponding data member.(b) define a getter for each data member.(c) no need to define other methods.3. define class passengerstakeelevator. (a) define data member as an elevator and a list of passengers (read api of arraylist). the main difference between an array and a list is that a list can grow (add an element to the list) or shrink (remove an element from the list) dynamically; however, to access an individual element, we need to start from the head of the list.(b) define a default constructor, use an elevator created from a default constructor, and build a list of three passenger. for each passenger, currentfloor and targetfloor are random ints between the basefloor and topfloor of the elevator. note that for each passenger, currentfloor cannot be the same as targetfloor (otherwise, there is no need to move the passenger using ) define a non-default constructor that takes an elevator and a list of passengers.(c) define method schedule. let the elevator serve passengers in the first-in and first-out order. for simplicity, you can assume that2 there is only one elevator, and the elevator can only carry one passenger a time. for each passenger, we first need to move the elevator to the current floor of that passenger if the elevator is not in that floor yet. then bring the passenger to his/her target floor. print out a message every time the elevator movesfor example, passenger 0 is at fl 5, will go to fl 2 elevator is at fl 1 elevator moves up from fl 1 to fl 5 elevator carries passenger down from fl 5 to fl 24. define a client class to test passengerstakeelevator. a sample output may look like: a. passenger 0 is at fl 5, will go to fl 2 elevator is at fl 1 elevator moves up from fl 1 to fl 5 elevator carries passenger down from fl 5 to fl 2b. passenger 1 is at fl 3, will go to fl 2 elevator is at fl 2 elevator moves up from fl 2 to fl 3 elevator carries passenger down from fl 3 to fl 2c. passenger 2 is at fl 4, will go to fl 3 elevator is at fl 2 elevator moves up from fl 2 to fl 4 elevator carries passenger down from fl 4 to fl 3

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 16:30
Select the correct answer. larry finds it easy to run legacy programs and applications in a virtualized environment. how does the virtualization provider make this possible? a. combines workloads of several underutilized servers to fewer machines b. installs and runs different versions of an operating system on the same computing device c. moves virtual machines from one server to another server at a different location d. streamlines and automates management tasks
Answers: 1
question
Computers and Technology, 23.06.2019 01:30
Jason works as an accountant in a department store. he needs to keep a daily record of all the invoices issued by the store. which file naming convention would him the most? a)give the file a unique name b)name the file in yymmdd format c)use descriptive name while naming the files d)use capital letters while naming the file
Answers: 3
question
Computers and Technology, 23.06.2019 13:30
Font size, font style, and are all aspects of character formatting.
Answers: 2
question
Computers and Technology, 23.06.2019 18:00
Which is a possible benefit of having a good credit history? having a checking account low interest rate on a car loan high interest rate on a credit card offer bankruptcy
Answers: 1
You know the right answer?
1. define class elevator. for simplicity, we do not consider property like capacity (or weight limit...
Questions
question
Computers and Technology, 02.07.2019 10:50
Questions on the website: 13722362