The MediaLib assignments are an introduction to Object Oriented Programming. You create and access Song objects as a way to learn to use objects.
Assignment 1.1.2: Define a class and use constructors methods.
- Feel free to look at outside resources that explain classes, objects, and constructors.
Assignment 1.1.3: Create a bunch of song objects and access their info with getter and setter methods.
- This assignment will start to create repetitive work. If you can think of a clever way to do it with less work, feel free to do so.
Assignment 1.2.1: Read song info from a file and write to files
(starter code is here)
Starter code is provided (link above), but you don’t actually have to use that starter code. You can use my section on reading from a text file to write your own file scanner if that seems easier.
Read the starter code and figure out what’s happening, at a minimum.
If you can do this assignment in a more efficient way than the assignment specifies, please do so!
For example, instead of using indexOf() and subString() to take the text apart, you can use the split() method on the Strings instead. It’s faster and easier. The output of split() is a String[] array – feel free to search for examples online for using that. (arrays come up in the next assignment anyway, so it doesn’t hurt to look at it now)
Either way you do this will be good practice. Better yet, figure out how to do it both ways. If you think that sounds crazy, recall that people get good at programming by writing lots of programs.
1.1.2 Today’s Top 40
- Feel free to use better songs than the ones this assignment suggests…
- This assignment uses a regular array of Song objects: feel free to use ArrayList<Song> instead of a Song[] array. ArrayLists have some advantages.
- An important part of this assignment is the idea of looping through an array of objects. Make sure you use both types of loops: “for” loop and “for each” loop.