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!