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, 24.06.2019 14:40
Create a function (prob3_6) that will do the following: input a positive scalar integer x. if x is odd, multiply it by 3 and add 1. if the given x is even, divide it by 2. repeat this rule on the new value until you get 1, if ever. your program will output how many operations it had to perform to get to 1 and the largest number along the way. for example, start with the number 3: because 3 is odd, we multiply by 3 and add 1 giving us 10. 10 is even so we divide it by 2, giving us 5. 5 is odd so we multiply by 3 and add one, giving us 16. we divide 16 (even) by two giving 8. we divide 8 (even) by two giving 4. we divide 4 (even) by two giving 2. we divide 2 (even) by 2 to give us 1. once we have one, we stop. this example took seven operations to get to one. the largest number we had along the way was 16. every value of n that anyone has ever checked eventually leads to 1, but it is an open mathematical problem (known as the collatz conjectureopens in new tab) whether every value of n eventually leads to 1. your program should include a while loop and an if-statement.
Answers: 3
question
Computers and Technology, 24.06.2019 22:00
True or false technology is often discovered by accident
Answers: 2
question
Computers and Technology, 24.06.2019 22:30
In writing a paper for his english class, gavin quoted an author of the book. what should he include in his paper to credit the source? citation caption header entry
Answers: 1
question
Computers and Technology, 24.06.2019 23:00
Aselect query joins tables together by their a. table names. b. primary keys. c. first entries. d. field names.
Answers: 2
You know the right answer?
1. define class elevator. for simplicity, we do not consider property like capacity (or weight limit...
Questions
question
Mathematics, 04.12.2021 01:00
question
Mathematics, 04.12.2021 01:00
question
English, 04.12.2021 01:00
question
Mathematics, 04.12.2021 01:00
question
Mathematics, 04.12.2021 01:00
question
Mathematics, 04.12.2021 01:00
Questions on the website: 13722367