Okay so I am currently coding this project in BlueJ, here is what I have so far:
I have 5 classes thus far:
-Film : which I have got to create a film object which includes the films (title, director, release year and duration) ... I will want it to be able to get these details from reading a text film rather than manual input at some stage.
-Show: The show takes the film and creates a show, a show consists of the films duration plus the ad duration (currently 20 minutes) and round up to the nearest hour. Showings are either 2, 3, 4 or 5 hours long. My current setup is to store the show time limits in an array in reverse order, i then have a for loop which runs as many times as there are instances in the array. This takes the array value i.e. 120 for 2 hours and minus' the sum of the film and ad duration. If its >= 0 it stores the value of the array item into a variable named showDuration. - is there a cleaner way?
I also have empty classes at the moment: Show Schedule, Screen and Cinema.
-showschedule creates a schedule from the shows
-screen selects a schedule
- cinema displays films on show plus creates screens
!!! I also need to create a class to handle seat bookings
My issues at the moment are this:
It is required that the class Show returns the film information ( title, director, release year and duration - 2 String and 2 int).
I don't know if I should be storing the values of the film object within the show object from when the show object is being created (duplication / efficiency issues here perhaps?)
How do I return 2 different types of values at once without using the to string command.
Orrr do I somehow reference the film object initially used to create the show object and use a method call on the film object to return the values?
so far I have this accessor method ...
public Film getFilmDetails()
// to be completed
A final issue for now is forward thinking. I want to be able to create a new cinema object which automatically generates the 4 screens which
Please can you help me out, Im not expecting code but some thoughts on the issues I have raised and some learning materials would be hugely beneficial
You are trying to bite off more than you can chew. You need to get your requirements down, and divide and rule. Get your Film class (for example) and write it according to the usual rules: fields, constructor, get methods, toString equals and hashCode, the last three of which you can read about in the Bloch Langer and Odersky references I quoted here.
I personally would make the Film class immutable, but that may be beyond the requirements of your course at present.
If you have the misfortune to use BlueJ (I don’t like it), you can right-click the class and instantiate it by calling the constructor and writing "The Ten Commandments", "Cecil B deMille", 1922, 230 in the box. Now you can inspect the object, call its toString method, etc, and see how it works. I would use a demo class