:: Syllabus
:: Schedule/Assignments
:: Class Notes
Schedule
Day
Mon/Wed
10:00-11:40 AM
T540
Required Text(s) - 1
You may use the text from last semester:
Introduction to Java Programming-Comprehensive, 6th Edition
Y Daniel Liang
Pearson/Prentice Hall
ISBN: 0132221586
Available from Amazon
or any recent Java textbook (please see me to confirm that the text is acceptable)
Announcements:
NO CLASS ON 2.23.08
Alternative Assignment for 2.23.08 - complete the Thing 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