Skip to main content

Post content has been hidden

To unblock this content, please click here

Doughnut
Beginner June 2008

Java programming people

Doughnut, 7 July, 2009 at 20:00 Posted on Off Topic Posts 0 9

I need you on call this week please ? I am reeeeeeeeeeeeeeeeeeeeeeeeeeeeally struggling, both with the assignment that has to be in this weekend, and the will to live through this module.

I have one quick question if anyone's about?

9 replies

Latest activity by Doughnut, 7 July, 2009 at 21:17
  • Doughnut
    Beginner June 2008
    Doughnut ·
    • Report
    • Hide content

    I neeeed you ?

    OK I'm sure this is a typical beginners assignment. I have to make a coach booking system. I have coach trips and bookings for people to go on there. I have a Date class from the tutor that I may or may not have to use.

    I have a Trip class with getCode, getDestination, getDate, getPrice methods. I have a Booking class with the customer's name, tel no, number of adults and numbers of children, who are charged at half price (not done anything with that yet).

    I know I will need an ArrayList, I guess in the Trip class, to hold the bookings?

    Does this sound OK so far? Once I need to start booking seats I will need your help if that's OK?!

    • Reply
  • Doughnut
    Beginner June 2008
    Doughnut ·
    • Report
    • Hide content

    I think so... I'm a bit shaky on associating classes (it's not callled that I know) - when they call each other's methods etc. I want them all in one massive place together ?

    So I'm going to have an addBooking which, erm, adds bookings to the trip. I have:


    public void addBooking (Booking booking)
    {
    bookings.add(booking);
    }

    Does this look right? I hate programming! I cannot imagine what possessed me to do this course, seriously.

    • Reply
  • Doughnut
    Beginner June 2008
    Doughnut ·
    • Report
    • Hide content

    Just one more thing on this ArrayList *** - I have

    private ArrayList<Booking> bookings;

    in the field declaration bit. Do I need to put

    bookings = new ArrayList<Booking>();

    in the constructor? I'm guessing not but I'm not sure why... I don't get this at all ☹️

    • Reply
  • Doughnut
    Beginner June 2008
    Doughnut ·
    • Report
    • Hide content

    Thank you so much for your help. I just cried again before I read your reply ? Poor H was trying to sing along to Reverend and the Makers and ask me how to get some invisible 'stain' out of his shirt and I lost it.

    I find it hard to know where stuff is 'stored' - I'm more used to the way databases work, so I want more booking stuff in the booking class, but I guess that just holds the customer's details?

    Why/ how on earth did you become a Java person, if you don't mind me asking?

    • Reply
  • T
    Beginner
    tea and toast ·
    • Report
    • Hide content

    Oh the memories this brings back!! I did java at uni but it's all well and truly forgotten now so I'm afraid I'm no help! But I feel your pain, it's hard enough with all those classes and stuff.

    • Reply
  • Doughnut
    Beginner June 2008
    Doughnut ·
    • Report
    • Hide content

    Can I ask something more? Sorry, I feel like I'm taking liberties a bit now. I'm studying online so I have no-one to ask.

    I need to check whether a booking has already been made on a trip. Does this sound OK?

    public boolean isBooking()
    {
    if (bookings.size() > 1)
    {
    return true;
    }
    else
    {
    return false;
    }
    }

    • Reply

You voted for . Add a comment 👇

×


Related articles

Premium members

  • Q
    Qa Test I got married in August - 2022 North Yorkshire

General groups

Hitched article topics

Contest icon

Win £3,000 for your wedding

Join Hitched Rewards, where you can win £3,000 simply by planning your wedding with us. Start collecting entries, it's easy and free!

Enter now