Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 5 of 5

Thread: UML modelling missunderstanding

  1. #1
    Junior Member
    Join Date
    Dec 2013
    Location
    London
    Posts
    11
    Thanks
    1
    Thanked 2 Times in 2 Posts

    Default UML modelling missunderstanding

    Hello programmers,

    My question is about article I've read in "Java in two semesters" by Quentin Charatan & Aaron Kans.
    I'm trying to make exercise from this book, which by scenario is following:

    "University allows lecturers to borrow equipment. The equipment is available for use 5 days a week and for 7 periods during each day. When the equipment is booked for use, the details of the booking(room number and lecturer name) are recorded. When no booking is recorded, the equipment is available for use.

    a. Create a booking class defined in the UML diagram below:

    Booking
    ---------------------
    -room:String
    -name:String
    ---------------------
    +Booking(String, String)
    +getRoom():String
    +getName():String

    [I]b. Now a timetable class is defined to process these booking. Its UML diagram is given below:[I]

    [B]Timetable[B]
    ----------------------
    -times:Booking[][]
    ----------------------
    +TimeTable(int,int)
    +makeBooking(int,int,Booking):boolean
    +cancelBooking(int,int):boolean
    +getBooking(int,int):Booking
    +numberOfDays():int
    +numberOfPeriods():int

    As you can see, the attribute of this class is two dimensional array of Booking object. The methods of this class are defined below:

    +Timetable(int,int)
    A constructor accepts the number of days per week and number of periods per day and size the timetable accordingly. You should note that initially all elements in the array will of course have a null value - a null value will represent an empty slot.....

    AND SO ON...
    BUT I can't really get how can constructor receive an integers, if there is actually no place to store them (or I really miss something, as I can see just one attribute of Booking two dimensional array is the only attribute TimeTable class has) or as second dimension I somehow going to convert them to Strings in booking class??? Everything I could think of it's missing attributes in booking class/timetable class. Does anyone have any idea?

    p.s. sorry for life-long writing, I've just tried to be sure that I didn't missed anything!
    And thank you in advance!


  2. #2
    Forum VIP
    Join Date
    Jun 2011
    Posts
    317
    My Mood
    Bored
    Thanks
    47
    Thanked 89 Times in 74 Posts
    Blog Entries
    4

    Default Re: UML modelling missunderstanding

    It looks like the two integers passed into the constructor are to initialize the size of the two dimensional array.

    public TimeTable(int daysPerWeek, int numberOfPeriodsPerDay) {
        times = new Booking[daysPerWeek][numberOfPeriodsPerDay];
    }

  3. The Following User Says Thank You to ChristopherLowe For This Useful Post:

    skuch89 (December 21st, 2013)

  4. #3
    Junior Member
    Join Date
    Dec 2013
    Location
    London
    Posts
    11
    Thanks
    1
    Thanked 2 Times in 2 Posts

    Default Re: UML modelling missunderstanding

    Thank You, ChristopherLowe... I actually couldn't even imagine this:/ It may work, and as soon as I'll get back I'll try, reply later!

  5. #4
    Junior Member
    Join Date
    Dec 2013
    Location
    London
    Posts
    11
    Thanks
    1
    Thanked 2 Times in 2 Posts

    Default Re: UML modelling missunderstanding

    Yeah, just checked. Everything works perfect!
    Thanks

  6. #5
    Forum VIP
    Join Date
    Jun 2011
    Posts
    317
    My Mood
    Bored
    Thanks
    47
    Thanked 89 Times in 74 Posts
    Blog Entries
    4

    Default Re: UML modelling missunderstanding

    Glad to help. Happy coding.

Similar Threads

  1. Uml diagram...
    By Flames in forum What's Wrong With My Code?
    Replies: 3
    Last Post: December 1st, 2012, 08:39 PM
  2. Help with WSDL and UML
    By dsavatar in forum Java Theory & Questions
    Replies: 1
    Last Post: November 28th, 2012, 03:34 PM
  3. UML Feedback?
    By behedwin in forum Object Oriented Programming
    Replies: 2
    Last Post: October 13th, 2012, 11:13 AM
  4. Need Help with this UML
    By Akirien in forum Object Oriented Programming
    Replies: 2
    Last Post: September 26th, 2012, 01:03 AM
  5. UML Diagram Help
    By chizzle in forum What's Wrong With My Code?
    Replies: 1
    Last Post: April 15th, 2010, 04:12 AM

Tags for this Thread