You have been contracted by TravelEverywhere to resolve a few issues related with their online system. You will need to utilise the classes and methods provided to resolve the issues.
When a customer requests a flight, ensure that there is a seat available for the user (4 marks)
bookFlight has the following method signature: static FlightBooking bookFlight(List<Passenger>, Flight); You can access this method in the TravelEverywhere class.
A travel agent will book flights for a customer. A customer will provide a passenger list
The method bookFlight will return a FlightBooking object if:
- Passenger objects are provided
If passengers are not provided, your method should output No passengers specified, unable to create booking
- A Flight object is provided
If a flight object is not provided, your method should output No flight specified, unable to create booking
- A list of passenger specified must be able to board the
If the number any number of passengers cannot board the flight, your method should output Cannot allocate passengers to flight, unable to create booking
If your method fails to construct a FlightBooking object, your method must return null.
Verify the itinerary object (4 marks)
verifyItinerary has the following method signature: static boolean verifyItinerary(Itinerary); You can access this method in the TravelEverywhere class.
A itinerary object will be passed to the method verifyItinerary which will require the itinerary to be considered valid before it is passed to the customer. The method must return true if the itinerary is valid, an itinerary is valid if:
- An itinerary object must not be
If the itinerary object is null, your method must output Itinerary not provided, unable to verify
- A customer object must be attached to the Itinerary object, otherwise your method must output No customer attached, verification failed
- The itinerary has at least 1 FlightBooking object attached to it, otherwise your method must output No FlightBooking exists, verification failed
If the verification succeeds, your method must return true, other your return false.
Construct an Info interface with the following properties (2 marks)
You will need to construct an interface with the name of Info which will have the following methods. The methods should return the respective properties (title and description) from the SafetyInfo class.
- getTitle(), String
- getDescription(), String
Change the following class SafetyInfo to implement the interface Info.
Create a TravelInfo class which will contain information about of travel destinations (5 marks)
Note: We have provided an interface to ensure you have written the correct methods, compile your TravelInfo class independently to ensure that it correctly implements the TravelDocument interface.
TravelEverywhere wants to ensure that everyone booking a trip to a holiday destination receives a travel information about their destinations. You will need to construct a TravelInfo class that will have the following properties:
- Title, String
- Description, String
- ContactName, String
- Destinations, List<String>
You will need to create getters and setters for each property and ensure that they are not accessible outside of the class (no setter is required for the Destinations object).
You will need to create the following constructor:
TravelInfo(String title, String description, String contactName).
Your constructor will throw a runtime exception if any of the fields provided are null. You may utilise the RuntimeException class or create your own inherited copy.
Destinations can be added to a list in the TravelInfo object with the following method addDestination(String destination).
本网站支持淘宝 支付宝 微信支付 paypal等等交易。如果不放心可以用淘宝交易！
E-mail: [email protected] 微信:dmxyzl003