Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

need java help

Options
  • 17-04-2001 8:48pm
    #1
    Registered Users Posts: 1,967 ✭✭✭


    I need to figure this out and see where im going wrong. I have it done already in my own way and I may think it's right but it looks dodgy. I know this is preety basic stuff but if you wanna give me a hand it would be appreciated. Thanks.

    adnans

    Question 1:

    (a)
    Write Java program code to create a class, which is to be used to represent airline reservations. The class should contain private variables to store the fallowing:
    • The Flight Code
    • The name of the departure airport
    • The name of the arrival airport
    • The name of the person making the reservation
    • The price of the seat reserved

    The class should also contain a constructor for creating objects from the class description.

    The class should contain public methods to retrieve and set the values of an object's private variables.

    The class should also contain a print method for displaying the contents of an object on the screen.

    (b)
    Write a Java program, which asks the user to enter the details required for making a flight reservation. The data entered by the user should be used to create an airline reservation object. Finally the contents of this object should be printed in the screen.

    (c)
    Modify the program you wrote in (b) above so that the user is asked to enter the details of five airline reservations. These details should be used to create five corresponding airline reservation objects, which should be stored in an array.

    (d)
    Modify the program you wrote in (c) above so that it searches the array of airline reservation objects for the object with the highest fare. The details of this object, if found, should be printed to the screen.

    (e)
    Finally, modify the program you wrote in (d) so that it also prints the details of all flight reservations to "Dublin".

    end of Question 1



Comments

  • Registered Users Posts: 21,264 ✭✭✭✭Hobbes


    You should ask your teacher to supply the tests on floppy disk so it's easier to cut and paste in your homework.


  • Moderators, Music Moderators Posts: 1,481 Mod ✭✭✭✭satchmo


    so what's the problem?


  • Registered Users Posts: 1,967 ✭✭✭adnans


    <font face="Verdana, Arial" size="2">Originally posted by Hobbes:
    You should ask your teacher to supply the tests on floppy disk so it's easier to cut and paste in your homework.</font>

    Im in full time work Hobbes and this is from my Java course that I went to few months ago. Im tryin to catch up with my java and I should have written also, "No Smart Comments" after the message. ah well

    adnans



  • Registered Users Posts: 1,967 ✭✭✭adnans


    <font face="Verdana, Arial" size="2">Originally posted by Jazz:
    so what's the problem?</font>

    From what ive understood of the question it asks you to write 2 seperate java classes which is a bit too complicated for my knowledge of Java and my arrays are the worst you can find.

    If you can point me in the right direction I would appreciate it.

    adnans



  • Closed Accounts Posts: 1,819 ✭✭✭K!LL!@N


    I don't mean to be patronising, but it's not at all difficult. Just read over your notes.

    If you post up your attempt at it i will show you where you are going wrong. biggrin.gif


  • Advertisement
  • Registered Users Posts: 380 ✭✭dogs


    <font face="Verdana, Arial" size="2">
    I should
    have written also, "No Smart Comments" after the message.
    </font>

    Well what exactly did you expect ? "Here's the code, ..."
    You can see for yourself that even though it may not be a particularly difficult task there's a bit too it.
    Post specific questions by all means, or even a link to your present attempts and ask for tips towoards improving it.
    As it is, I dont think you're going to get that much help ...even if someone did post all the code you required...


  • Registered Users Posts: 932 ✭✭✭yossarin


    model the airline reservation object.

    write a class to instanciate (spelling?) and index it.

    could you post what you have done adnans?
    _________________________________________

    Is the airline example as frequently used as hello world? There seems to be equivalents in every language smile.gif

    ha ha 69 posts...

    [This message has been edited by yossarin (edited 18-04-2001).]


  • Registered Users Posts: 1,967 ✭✭✭adnans


    im such a cheeky bugger. smile.gif i'll post my attempt when i got home from work and hopefully my homework *oops*, my revision more like will be done. thanks all

    adnans


  • Registered Users Posts: 1,967 ✭✭✭adnans


    <snip> wrong code

    this is my attempt, laugh at my coding and tell me my mistakes. smile.gif

    adnans

    [This message has been edited by adnans (edited 15-05-2001).]

    [This message has been edited by adnans (edited 15-05-2001).]


  • Registered Users Posts: 7,468 ✭✭✭Evil Phil


    Where's the flight reservation code?


  • Advertisement
  • Closed Accounts Posts: 104 ✭✭Sean


    lol i don't now confused.gif


  • Closed Accounts Posts: 104 ✭✭Cliph


    Thiese should help with part (a) at least

    http://www.redbrick.dcu.ie/~phil/java/AirlineTest.java.html
    http://www.redbrick.dcu.ie/~phil/java/Airline.java.html

    Ask again if you need more assistance, but you should be able to make a good stab at it from there.


Advertisement