Results 1 to 11 of 11
- 08-16-2011, 08:06 PM #1
Member
- Join Date
- Aug 2011
- Posts
- 4
- Rep Power
- 0
Help with travel agency assignment
Hey, I need to help in deveolping a travel agent system. The spec is as followed:
Travel Agents system
You are to develop program in Java for a small travel agents. The company arranges holidays
from four UK airports to five international destinations. Users need to find flight times and costs
for journeys between these destinations. The system also provides information on hotels at the
destinations (name of hotel and cost per person per night). Information on hotels can only be
added, or loaded from file, when the program is running. The following table (Table 1) provides
the airport names, destinations, costs and flight times for the journeys
Table 1 Information for the travel agents program – the two values represent cost (£) and flight
time (hours) respectively – you can make up your own (realistic values) if you wish
Airport/Destination | New York |Dahab | Rome |Sydney |Tokyo
East Midlands |200/5.0 |150/4.0 |100/1.0 |500/22.0 |400/12.0
Birmingham |190/4.8 |140/3.5 |95/1.1 |480/22.5 |380/12.5
Heathrow |195/4.9 |140/3.6 |95/1.1 |490/23.0 |390/12.5
Manchester |210/5.5 |145/3.7 |110/1.2 |470/22.7 |370/12.6
(the above is a data table, where there is a line, represents the cell)
Your program should have a main menu with four options – Time, Price, Hotels and End (which
terminates the program). The Hotels option takes the user to another (Hotel) menu with the
following six options – View Hotels; Add Hotel; Delete Hotel; Save Hotels; Retrieve Hotels; Exit
(back to the previous menu). Note that your program should include appropriate error trapping –
for example, entering an invalid date (eg 30 February).
Functionality for each of these menu options is explained below:
Time – Provides the flight time presented in hours.
Price – The cost of travelling from an airport to a given destination (both selected by the user).
Note, if the customer is travelling on the last day of the month the fare should be increased by
5% (and display a message to say that this has been done). The system will therefore need to ask
the user the date of travel. It should not simply ask the user if it is the end of the month – but
work this out from a date provided by the user.
Hotels – Takes the user to a Hotels Information Menu.
Hotels menu
View Hotels – The user selects a destination and the system displays all available hotels at that
destination including the overnight cost per person. If there are no hotels for a destination it
should display a message to say so.
Add Hotel – Allows the user to add a hotel for a given destination. This should add to the list of
existing hotels for that destination (if there are any). For example, I might add ‘Belle Vue’ as a
hotel in Sydney at a cost of £50 per person per night.
Delete Hotel – Allows the user to delete a hotel from a list of hotels at a destination.
Save Hotels – save all the information on all hotels to a single file in a format of your choosing.
Retrieve Hotels – read in all the information on hotels from a user selected file (a file saved using
the previous option). This should overwrite any existing hotel data in the program when it is
running.
I'm asking for someone to help me start and creat the first function. I'm not a great programmer at Java so would really reallly appreciate for someone to help me as soon as possible. Thanks
- 08-16-2011, 08:38 PM #2
- Join Date
- Jan 2011
- Location
- Richmond, Virginia
- Posts
- 3,069
- Blog Entries
- 3
- Rep Power
- 7
I moved your post to a new thread. In the future, please don't hijack other people's threads. Instead create your own thread(they're free!).
People here aren't going to do this for you. If you are lucky you may get a bit of pseudo-code, but you should try this yourself and tell us what you are stuck on. Think small, and build on it.
- 08-16-2011, 09:49 PM #3
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,385
- Blog Entries
- 7
- Rep Power
- 17
- 08-17-2011, 02:36 AM #4
Member
- Join Date
- Aug 2011
- Posts
- 40
- Rep Power
- 0
Fellow Noobie here!
These guys are awesome for when you are really having an issue. They really really know their stuff. They are saints for being willing to help us noobies out with our issues, but even then, they are more apt to write something that might seem cryptic to you and I. Its not meant to tell you to go away, its meant to encourage you to look further into what they wrote. As it should be. I learned more from these guys, like that, than i ever did from my former instructor.
Please don't ask for them to write code for you. Its not what they do on these forums. Heck, i get the distinct feeling that many of these guys get payed to write code. As a Chef, i know how it feels to cook all day, and then be expected to come home and cook for the family before heading to rest. But, sure ill give advice to someone who is having issues gettign a meal to turn out right. Its no different for them.
- 08-17-2011, 07:27 AM #5
- 08-17-2011, 07:55 PM #6
Member
- Join Date
- Aug 2011
- Posts
- 4
- Rep Power
- 0
This is what i've done so far, any advice on where to go from here. Im wanting to create a function where the user inputs a number for the menu and takes them to the next part of the program. once done ill then create the price and time function but need help to link the menu to the price and time functionJava Code:package travel.agent.system; import java.util.Scanner; public class TravelAgentSystem { private price [][] fare; private time [][] distance; public TravelAgentSystem(){ String [] destination = new String[4]; destination[0] = "New York"; destination[1] = "Dahab"; destination[2] = "Rome"; destination[3] = "Sydney"; destination[4] = "Tokyo"; String [] airport = new String[3]; airport[0] = "East Midlands"; airport[1] = "Birmingham"; airport[2] = "Heathrow"; airport[3] = "Manchester"; fare = new price [3][4]; fare[0][0] = new price(200); fare[0][1] = new price(150); fare[0][2] = new price(100); fare[0][3] = new price(500); fare[0][4] = new price(400); fare[1][0] = new price(190); fare[1][1] = new price(140); fare[1][2] = new price(95); fare[1][3] = new price(480); fare[1][4] = new price(380); fare[2][0] = new price(195); fare[2][1] = new price(140); fare[2][2] = new price(95); fare[2][3] = new price(490); fare[2][4] = new price(390); fare[3][0] = new price(210); fare[3][1] = new price(145); fare[3][2] = new price(110); fare[3][3] = new price(470); fare[3][4] = new price(370); distance = new time[3][4]; distance[0][0] = new time(300); distance[0][1] = new time(240); distance[0][2] = new time(60); distance[0][3] = new time(1320); distance[0][4] = new time(720); distance[1][0] = new time(288); distance[1][1] = new time(210); distance[1][2] = new time(66); distance[1][3] = new time(1350); distance[1][4] = new time(750); distance[2][0] = new time(294); distance[2][1] = new time(216); distance[2][2] = new time(66); distance[2][3] = new time(1380); distance[2][4] = new time(750); distance[3][0] = new time(330); distance[3][1] = new time(222); distance[3][2] = new time(72); distance[3][3] = new time(1362); distance[3][4] = new time(756); } public static void main(String[] args) { // Local variable int swValue; // Display menu graphics System.out.println("============================"); System.out.println("| MENU SELECTION DEMO |"); System.out.println("============================"); System.out.println("| Options: |"); System.out.println("| 1. Time |"); System.out.println("| 2. Price |"); System.out.println("| 3. Hotel |"); System.out.println("| 4. End |"); System.out.println("============================"); System.out.println(" Select option: "); swValue(); } public static void swValue(){ int choice = 0; int menu; Scanner scanner; scanner = new Scanner(System.in); choice = scanner.nextInt(); switch (choice) { case 1: System.out.println("Time selected"); break; case 2: System.out.println("Price selected"); break; case 3: System.out.println("Hotel selected"); break; case 4: System.out.println("End selected"); default: System.out.println("Invalid selection"); } } } price class package travel.agent.system; /** * * @author Priyan */ public class price { private double price; public price(double p){ price = p; } public double getPrice(){ return price; } } time class package travel.agent.system; /** * * @author Priyan */ public class time { private int time; public time(int t){ time = t; } public int getTime(){ return time; } }
thanksLast edited by Norm; 08-17-2011 at 08:19 PM. Reason: Added code tags
- 08-17-2011, 08:22 PM #7
You could do this by using a Dialog to present a window where the user can input whatever you want.Im wanting to create a function where the user inputs ...
When the user exits the dialog, you can get his input and process it.
For simple input, you could use a JOptionPane.
- 08-17-2011, 08:32 PM #8
Member
- Join Date
- Aug 2011
- Posts
- 4
- Rep Power
- 0
Thanks, but I forgot to say, I'm only doing this in command line for now and if I have the time I will then modify and change it to a GUI. Do you know how I would go about doing it this way? I have taken the switch statement out and replaced it with an if statement
- 08-17-2011, 08:34 PM #9
To get input from a user: print a message asking the user to input and then read the response. Test if the answer is valid and continue if so, else explain the error and loop back to ask the user again for the input.
- 08-17-2011, 08:46 PM #10
Member
- Join Date
- Aug 2011
- Posts
- 4
- Rep Power
- 0
I've got the input from the user done now, thanks. but the next thing I want to do is to display an array of string. for example, if the user select time, the next stage for the program is for the user select from a list of arrays which i want to display, i then want to take your choice as an index to be used further on in the program.
- 08-17-2011, 09:09 PM #11
Similar Threads
-
HW assignment help
By mackavelirip in forum New To JavaReplies: 5Last Post: 03-31-2011, 03:34 AM -
assignment
By mr.othman in forum New To JavaReplies: 4Last Post: 12-03-2010, 02:55 PM -
Need help with a assignment
By helpMe.Java in forum New To JavaReplies: 7Last Post: 06-06-2010, 04:49 PM -
GUI First Assignment-DUE 8/1/08
By ljk8950 in forum AWT / SwingReplies: 2Last Post: 08-01-2008, 04:23 AM -
J2EE Travel Web Services Project
By freudonspeed in forum Jobs OfferedReplies: 0Last Post: 02-13-2008, 10:00 PM


4Likes
LinkBack URL
About LinkBacks
Reply With Quote
-.gif)

Bookmarks