1 Introduction
The following programming problem is designed to help us assess programming ability,
including:
Java skills
Please read the problem carefully and then solve it using standard Java programming
techniques. When you are happy with your solution, please email back to your
representative.
Please do not spend more than one working day on the exercise. If you
havent solved it in this time, send us what you have.
Send us your complete solution, including the source code, any unit tests, Ant
builds etc. We need to be able to run your solution, verify that it works and
also have a good look at your code.
Our firewall will not allow batch files in an email attachment, even within a zip
file. Please change the extension of any batch files to .txt, and let us know
which files you have changed.
You are free to implement any mechanism for feeding input into your solution
(for example, using hard coded data within a unit test). You should provide
sufficient evidence that your solution is complete by, as a minimum, indicating
that it works correctly against the supplied test data.
You may not use any enhanced functionality of the language or any external
libraries to solve this problem; however, you may use external libraries or
tools for building or testing purposes. For example, if you were solving a date
difference problem you would not be allowed to use a pre-programmed
function to calculate the date difference, but you would be allowed to use JUnit
or Ant to assist your development.
Java Programming Problem
The Cheapo Holiday Company would like to provide its customers with information about
the price of travel included in its holiday packages. In particular, it would like to show its
customers the cheapest travel itinerary for their selected holiday.
The model of a travel itinerary is necessarily simplified. For this problem an itinerary for a
group of passengers consists of the following three distinct legs:
2. A flight itinerary leg: One or more flights, at a cost of 10p / passenger / mile.
Flights are selected from a flight schedule which contains a pre-defined set of
aircraft routes. Each route defines the airports the aircraft stops at. A
passenger may board or depart a single aircraft at any airport along the route.
Routes are one-way and independent of each other; a passenger cannot
change to another route or plane halfway through a flight itinerary.
Your task is to write a program that will quote the cheapest price possible for a given travel
itinerary by finding the cheapest transfer and flight prices.
Java Programming Problem
2.2
Java Programming Problem
2.3 Input
The destination airport and the transfer distance from that airport
to the destination.
Java Programming Problem
2.4 Output
Either
No Such Route if the requested itinerary can not be quoted for (i.e.
there is no flight route between the requested airports)
Or
The cheapest transport type (Train, Car, Plane or Coach) and cost (in s
and pence) for each leg of the itinerary and the cheapest total cost of
the journey. If a leg has no cost associated with it (e.g. the passengers
lives less than a mile from their nearest airport or the destination is less
than a mile from the destination airport) then the information for that
leg should not be displayed.
Java Programming Problem
2.5
Java Programming Problem
2, A110, D20
4, A110, D20
2, D20, A110
1, A45, C5
4, D100, B0
1, A50, F20
Java Programming Problem
Itinerary #1:
Train: 33.00 Plane: 200.00 Coach: 20.00 Total: 253.00
Itinerary #2:
Car: 43.00 Plane: 400.00 Coach: 40.00 Total: 483.00
Itinerary #3:
No Such Route
Itinerary #4:
Train: 6.75 Plane: 90.00 Coach: 2.50 Total: 99.25
Itinerary #5:
Car: 40.00 Plane: 520.00 Total: 560.00
Itinerary #6:
No Such Route