Files from 03.26.08 class - the iTunes Project:
Files from 03.31.08 class - the iTunes Project:
Files from 04.02.08 class - the iTunes Project:
Files from 04.07.08 class - the iTunes Project:
Files from 04.09.08 class - the iTunes Project:
Files from 04.14.08 class - the iTunes Project:
Files from 04.28.08 class - the iTunes Project:
Files from 04.30.08 class - the iTunes Project:
Thing Exercise
Objective: Create/manipulate a database (using an array of object of type "thing")
I. Create a class "thing" which wil have:
1. One instance variable called title that will be of type String
2. The following non-static methods:
a. constructor - saves "value not yet assigned" in variable title
b. getTitle - a public method that returns value of title
c. setTitle - a public method that sets the value of title to the value passed to the method
d. printVariables - a public method that prints the value of title.
e. sortArray - a public method that will sort the array by alphabetic value of title by value of title
f. searchArray - a public methods that will search for a value of title and return the position in the array of that instance
II. Develop a demo class that will:
a. create an array of size 10 that will hold instances of the class thing - name the array arrayOfThings
b. use a for loop (limited to arrayOfThings.length) to create the 10 instances of the class thing and store them in arrayOfThings
c. use a for loop (limited to arrayOfThings.length) to ask the user for the title of each thing - store that value in each successive instance of thing - use the method setTitle tostore the value of title as entered by the user.
d. call methods b - f in 2 above, for example:
1. call the method printVariables
2. ask the user to enter the title for which they would like to search - call the method searchArray and print the position number within the array at which you found the value for the user
3. ask the user to enter the position within the array for which they would like to know the value of title - call the method getTitle and print the position number for the user
4. call the method sortArray
5. ask the user to enter a new value for a title and the position they want it stored to within the array - call the method setTitle
6. call the method printVariables |