5.1 Complete this exercise with the help of your group tutor as it will help you come up with an idea for an Object Oriented (OO) application for Assignment 3. However, your tutor will not be able to give you ideas for OO application on your behalf; They can only give guidance on general OO concepts. In Assignment 3, you only get marks for the design that is your own (e.g. number and choice of classes, how they and their objects relate to each other, what operations they perform and what member variables they contain, etc.)
Write the answers to parts a, b, c, d, e, f, in the submission page itself (no file uploads for this week). Do not repeat the question text as it could give you a similarity rating to other students work. Just write the part number then your answer (sample answers shown in italics; yours must be different).
- State the hypothetical name of your application. This would be your application class and you must state its name. E.g. MusicLibrary
- What other things need to be there be in the system that you have multiples of? These are your objects. E.g. array of songs in the
MusicLibrary
- Which of these objects would be of the same type? In IIE8 every song had a song title and a location and therefore every song in the song array came from the same Song class. List the classes that you have identified, in addition to the application class. E.g. Song
d). For each class above, specify what object member variables would be there. E.g. the Song class can have members String name, String location, int rating, int numberOfTimesPlayed so that every Song object will have a unique set of values for each of these variables. (Note: All member variables must be non-static explicitly private in Intro To Prog).
- From the member variables that you have identified in part d, which of these are mandatory when creating an object? In IIE8 we said that Song cannot be created without a title and a location (the other member variables such as rating and numberOfTimesPlayed are not that important to specify at the time of creating a Song object). These would be in your constructors parameters/arguments. For each class identified above, state the constructors parameters.
- State at least one other important method that must be there in the application that is not a simple get/set (accessor/mutator) method. E.g. a Song object has the getSongTitle method and the setSongTitle method but these are too obvious. Instead we are interested in methods like playSong or findSongs, etc.
Note: Even if you have not thought everything through, something planned in writing is better than just an idea in your head. Your answers to a-f need not be final but you must show effort in these.
Continued on next page
Page 1 of 2
Remember, when doing OO in Intro To Prog: Follow the guidelines given in CanvasAssignmentsAssignment 3 (guidelines). You must not create anything static other than public static void main. All object member variables must be private and they must only be initialised inside the constructor (including the creation of arrays). Any references to member variables from within methods should start with this.. There is no need for private methods. You will need to write a constructor for each class and you must prevent the creation of objects that are invalid (e.g. dont create a second constructor that will allow you to create a Song object with no song title or location). Use only standard arrays in Java (e.g. avoid ArrayList, etc.). You must not use break, continue, System.exit(). Use only while loops for repetition. When possible, you must use concepts covered in standard class materials over others.
- If you have not submitted your final version of A3, add comments explaining your plan. Note that this will not be marked but it is to help you progress.
Reviews
There are no reviews yet.