Results 1 to 9 of 9
Like Tree3Likes
  • 1 Post By SurfMan
  • 1 Post By Tolls
  • 1 Post By Tolls

Thread: Where to start this simple reservation program?

  1. #1
    Join Date
    Feb 2016
    Posts
    3
    Rep Power
    0

    Default Where to start this simple reservation program?

    Hi All,

    I'm new to Java.
    Recently registered for a degree in Software Engineering.
    Just right after two weeks they gave me assignment without explaining or even held a class for the Java.
    Anyhow I have to submit it on or before the deadline.

    I have set of question to ask some Java nerds.

    1) To run small java codes which one is better? servlets or java applets?
    I am a (PHP) web developer.
    So I prefer Java servlets which I can test easily using a webbrowser and during the viva I can submit my Java servlet URL link for reference.

    2) Recommended editor for Java? Netbeans or notpad++ ?
    Senior students are recommeding me Netbeans and I never worked in Netbeans before.
    Always for my developemnt needs I use Notepad++

    3) Is it possible to create a small reservation system within a week when I do not have any prior experience in Java?
    The assignment is:
    Write a simple airline ticket reservation program.
    The program should display a menu with the following options: reserve a ticket, cancel a reservation, check whether a ticket is reserved for a particular person, and display passengers.
    The information is maintained on an alphabetized linked list of names.
    In a simpler version of the program, assume that tickets are reserved for only one flight.
    Create a linked list of flights with each node including a reference to a linked list of passengers.

    I can do this easily in PHP but the requirment now is Java.

    Please do suggestions

  2. #2
    SurfMan's Avatar
    SurfMan is offline Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    1,993
    Rep Power
    9

    Default Re: Where to start this simple reservation program?

    1) For small Java programs, create a standalone class that has a public static void main(String[] args). There is absolutely no need to setup a JEE server in order to run a piece of code.
    2) Notepad(++) is good to start with because it forces you into learning how to compile, classpaths, packaging etc. Netbeans or all the other IDE's are awesome and save you a lot of repetative work. Once you are comfortable with the basic Java techniques, move to an IDE.
    3) Dive in. Just go and try something. It says display a menu. This means a handful System.out.printn("...") and a Scanner to read the input from the user.

    You can start to think about how to model your data. What would the classes look like. All the nouns can be classes: Airline, Flight, Ticket, Passenger. All the verbs can be methods: makeReservation(), bookTicket(), cancelTicket(), cancelFlight(), etc. An Airline has-a list of Flights. A Flight has-a list of Passengers. Not saying you need all of these, but you can start thinking about it in this way. Once you have your classes sorted out, you can build your user interface, in this case using System.out.println and Scanner, but you can also build that using Swing or JavaFX.
    foolishcoder7721 likes this.
    "It's not fixed until you stop calling the problem weird and you understand what was wrong." - gimbal2 2013

  3. #3
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    13,541
    Rep Power
    26

    Default Re: Where to start this simple reservation program?

    As SurfMan says, this looks like a case where a simple command line app would handle the job.
    Don't even think about servers, and forget about applets as they're not really supported anymore.

    Since you haven't done any Java before then I would suggest starting with Notepad++. Again, as SurfMan says, it will give you a chance to understand how compiling and executing works.

    Start simple, a stage at a time.
    Your first task is to display the menu.
    Then accept input from the user.
    Then handle each of the options, one at a time.
    Do not attempt to write all this at once!

    These should all be individual methods, so you can easily test them.
    foolishcoder7721 likes this.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  4. #4
    Join Date
    Feb 2016
    Posts
    3
    Rep Power
    0

    Default Re: Where to start this simple reservation program?

    Quote Originally Posted by SurfMan View Post
    1) For small Java programs, create a standalone class that has a public static void main(String[] args). There is absolutely no need to setup a JEE server in order to run a piece of code.
    Thanks for the explanation

    Quote Originally Posted by SurfMan View Post
    2) Notepad(++) is good to start with because it forces you into learning how to compile, classpaths, packaging etc. Netbeans or all the other IDE's are awesome and save you a lot of repetative work. Once you are comfortable with the basic Java techniques, move to an IDE.
    I thought the same.

    Quote Originally Posted by SurfMan View Post
    3) It says display a menu. This means a handful System.out.printn("...") and a Scanner to read the input from the user.
    I read some tutorials. It all say to run a piece of Java code in command prompt.
    When we have a menu / simple system running it in command prompt is a good idea?
    What I mean is how the interface for the menu?
    Is there any special software to compile and run this kind of Java program after we code it in Notpad++?

    Quote Originally Posted by SurfMan View Post
    All the nouns can be classes: Airline, Flight, Ticket, Passenger. All the verbs can be methods: makeReservation(), bookTicket(), cancelTicket(), cancelFlight(), etc. An Airline has-a list of Flights. A Flight has-a list of Passengers.
    Thanks for the idea.

  5. #5
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    13,541
    Rep Power
    26

    Default Re: Where to start this simple reservation program?

    trcooke likes this.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  6. #6
    SurfMan's Avatar
    SurfMan is offline Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    1,993
    Rep Power
    9

    Default Re: Where to start this simple reservation program?

    Quote Originally Posted by foolishcoder7721 View Post
    Is there any special software to compile and run this kind of Java program after we code it in Notpad++?
    Assuming you're on Windoze:
    javac.exe to compile
    java.exe to run

    You really should be looking at this page.
    "It's not fixed until you stop calling the problem weird and you understand what was wrong." - gimbal2 2013

  7. #7
    SurfMan's Avatar
    SurfMan is offline Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    1,993
    Rep Power
    9

    Default Re: Where to start this simple reservation program?

    Quote Originally Posted by Tolls View Post
    *sigh*. Should I feel proud for being anonymously quoted?
    "It's not fixed until you stop calling the problem weird and you understand what was wrong." - gimbal2 2013

  8. #8
    Join Date
    Feb 2016
    Posts
    3
    Rep Power
    0

    Default Re: Where to start this simple reservation program?

    Hey guys sorry for that..
    Actually I posted in one another forum before I posted in code ranch and java-forum.org but I did not get any reply for even after 2 days.

    So I've decided to post in coderanch and java-forum.org and take where ever I get a quick response.
    But both forums are awesome.. responded faster than I expected.

    Thanks guys..

  9. #9
    SurfMan's Avatar
    SurfMan is offline Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    1,993
    Rep Power
    9

    Default Re: Where to start this simple reservation program?

    Quote Originally Posted by foolishcoder7721 View Post
    Hey guys sorry for that..
    Actually I posted in one another forum before I posted in code ranch and java-forum.org but I did not get any reply for even after 2 days.

    So I've decided to post in coderanch and java-forum.org and take where ever I get a quick response.
    But both forums are awesome.. responded faster than I expected.

    Thanks guys..
    Crossposting is no problem as long as you mention it (plus link) so people can check if they it's been answered. Saves them precious time.
    "It's not fixed until you stop calling the problem weird and you understand what was wrong." - gimbal2 2013

Similar Threads

  1. Replies: 0
    Last Post: 03-11-2013, 12:00 AM
  2. Replies: 2
    Last Post: 10-31-2012, 01:24 AM
  3. Replies: 1
    Last Post: 01-18-2011, 07:27 PM
  4. java reservation class plane seat and reservation classes
    By cool_guy364 in forum Advanced Java
    Replies: 2
    Last Post: 10-15-2009, 10:56 AM
  5. Replies: 5
    Last Post: 03-20-2009, 11:04 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •