T
Tony Johansson
Hello!
We have the two classes Person and Elevator.
I just wonder method NewFloorRequest that set the floor that the elevator
should go to which class should it belong to between Person and Elevator.
I mean if I put it in class Elevator we can pass the floor that we want to
go to as a parameter.
Class Elevator has information about how many floor the elevator has which
mean the method can check if
the passed floor for NewFloorRequest is valid.
On the other hand if I put it in class Person which doesn't seem right but
if I still put it in class Person
we can return the floor that has been selected. Class Person doesn't know
anything about how many floor the elevator has
so that means the returned fllor might not be valid.
Which class would you thing is the best choice between Person and Elevator
for method NewFloorRequest ?
I hope you can give some motivation about you choice so I get a better
understanding about why the selected class is the best choice.
//Tony
We have the two classes Person and Elevator.
I just wonder method NewFloorRequest that set the floor that the elevator
should go to which class should it belong to between Person and Elevator.
I mean if I put it in class Elevator we can pass the floor that we want to
go to as a parameter.
Class Elevator has information about how many floor the elevator has which
mean the method can check if
the passed floor for NewFloorRequest is valid.
On the other hand if I put it in class Person which doesn't seem right but
if I still put it in class Person
we can return the floor that has been selected. Class Person doesn't know
anything about how many floor the elevator has
so that means the returned fllor might not be valid.
Which class would you thing is the best choice between Person and Elevator
for method NewFloorRequest ?
I hope you can give some motivation about you choice so I get a better
understanding about why the selected class is the best choice.
//Tony