8
8esha9
Guest
This is what i have to do:
A method named addReservation that adds a single new reservation to the array. This
method should read reservation information from the user (using the Scanner class),
create a new object based on that information, and add this object to the array. I leave the
implementation details up to you, but here are some things to keep in mind:
o You can’t create a new instance of Reservation directly since it’s abstract.
Therefore, you should be creating an instance of either HotelReservation or FlightReservation. Ask the user which one s/he wants, and depending on his/her
answer collect the appropriate information that the reservation type needs.
I have the first part of asking the user what they want but i need help with adding to the array. If someone could write an example for me so i can understand what to do i would really appreciate it.
A method named addReservation that adds a single new reservation to the array. This
method should read reservation information from the user (using the Scanner class),
create a new object based on that information, and add this object to the array. I leave the
implementation details up to you, but here are some things to keep in mind:
o You can’t create a new instance of Reservation directly since it’s abstract.
Therefore, you should be creating an instance of either HotelReservation or FlightReservation. Ask the user which one s/he wants, and depending on his/her
answer collect the appropriate information that the reservation type needs.
I have the first part of asking the user what they want but i need help with adding to the array. If someone could write an example for me so i can understand what to do i would really appreciate it.