Prof. Janet Brown-Sederberg
Computer Technology &
Information Management
Technology Building Room 105
508.588.9100 x 1630

jbrown-sederberg@massasoit.mass.edu

Advanced Java: Spring 2008

 

Schedule/Assignments

  • All assignments are to be submitted in electronic form via email as attached .java files, unless otherwise directed by Prof. Brown-Sederberg.
  • We will try to do as many homework assignments as possible in class, aassignments not completed during class are to be completed and submitted by the student at the start of the next chapter.
Topic Assignment Due
Arrays
Binary and Text I/O

TicTacToe
TTTwithMethods.java as developed in class 1.31.08

TicTacToe
TTTwithMethods02042008.java as developed in class 02.04.08

TicTacToe
TTTwithMethods02062008.java as developed in class 02.06.08

Racing
Racing.java as developed in class 02.11.08

Racing
RacingTeamfeb20.java
as developed in class

Scramble Word Game
scramble.java as developed in class on 02.25.08

Scramble Word Game
ScrambleAStringDemo.java as developed in class on 02.27.08
Assignment DUE 3.3.08 re: ScrambleAStringDemo,java and scrambleGame.txt:
1. Trace all variables processed by ScrambleAStringDemo.java as output in scrambleGame.txt (you are to hand your trace in) .
2. Revise ScrambleAStringDemo.java to allow the user to enter the word to be scrambled.
3. Revise ScrambleAStringDemo.java Using a loop to give the user 3 chances to guess the correct word, tell them is they are right or wrong in their guess.

Scramble Word Game ScrambleAStringDemoWithArray.java
as developed in class on 03.03.08

Reading/Manipulating and Writing to Files as demonstrated in class on 3.10.08
ReadManipulateWrite.java
file to use dictionary.txt

Reading/Manipulating and Writing to Files was demonstrated in class on 3.13.08. The file demonstrated in class:
ReadManipulateWriteNoDups.javaA "cleaned up" (I put the variables all in one place, removed unnecessary comments etc) version of that file:
ReadManipulateWriteNoDupsFinal.java

Completed Scramble Word Game as done in class:
ScrambleAStringDemoWithFile.java

HOMEWORK FOR MARCH BREAK

  1. Read the chapter in your text that covers Strings.
  2. Write a program that accepts a word from the user and then prints the reverse of that word. Name the class reverse.java
  3. Write a program that accepts a word from the user and then tells the user the number of vowels (a, e, i, o, u) and the number of consonants (everything but the consonants) in the word. Name the class count.java

 

 
Objects and Classes

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

 
Strings and Text I/O    
Inheritance and Polymorphism    
Abstract Classes and Interfaces    
Exceptions and Assertions    
Recursion    
Graphics    
 

Any fool can know. The point is to understand. - Albert Einstein