CST1642 Advanced Java II
Assignments


Click on this link to turn in your assignments:
\\Rc-hutch-ap\VOL1\HOME\allen_b\CST1642Labs
  • Turn in the complete folder for each exercise.  The folder should contain the .java and .class files.
  • Your name and exercise number should be in the comments at the top of the program.

Note:  This link only works if you are connected to the Ridgewater campus network and using Microsoft Internet Explorer. (Netscape cannot be used).

If you do not have network access, you may turn your homework in on a floppy disk or CD-ROM.  You must label the media with your name, assignment number, and course number.


Java Files & Utilites

Lab 1

Exercises

Exercise 1.1 The Car Park

Chapter 25 in Parr & Bell contains a problem, the car park. Exercise 25.5, page 481 in my book.

Use the techniques you have learn in the Core Java series, including those described in this chapter on threads. Hint: do some design work before you begin coding. Identify the classes you will need.

A car park has two entrances and two exits, each controlled by barriers.  A transducer at the entrance detects the presence of a vehicle and tells the computer.  If there is space in the car park it raises the barrier, issues a numbered ticket and records the time of arrival.  On exit an attendant keys in the ticket number, notifying the computer that the car is leaving.  The computer calculates the cost, displays it and raises the barrier.  The computer also controls an illuminated sign on the entrance which displays "FULL" or "SPACE AVAILABLE".  Write a program that simulates the behavior of the a car park.  Create four buttons that correspond to cars entering and leaving at the two entrances and two exits.  Start by assuming that the car park can accommodate only 10 cars.  Complete the problem as an application using swing.  Write the program using multiple threads.  Perhaps one thread per button.  The resulting class file should be an application, NOT an applet.


Lab 3A

Exercises

Exercise 3.1 Emailed Temperature Warning

In this exercise you are going to make a swing application that emails a designated user when the inputted temperature is higher or lower than the two temperatures that are set.  The email should say something like "High temperature alarm.  Current temperature is 96°F. Please check the air conditioning system in your home." or "Low temperature alarm.  Current temperature is 43°F.     Please check your heating system in your home."

Use the Example 3-4 MailTest.java on pages 211-215 of Core Java II as a base to get started.  The textbook code examples can be downloaded from the book website to save typing time. (See the link at the top of this page.)

Lab 3 Notes.

Authentication Notes.


Lab 3B

Exercises

Exercise 3.2 Retrieving information from the web

In this exercise you are going to modify your program from Lab 3A (Exercise 3.1).  Modify your program so that your program goes to some web site(s) and fetches a temperature, some weather related information, etc.  If want, you can do something else like fetching sport scores, stock market prices, etc.  Take the web pages that you retrieve, parse it for the data that you really want, and resend the data formatted into an email.  Send the email.  The email should be sent either on a regular interval of your choosing or when some occurrence warrants the sending of the email.

Use information and examples found on pages 221-263 of Core Java II to help you develop your program.


Lab 4A

Exercises

Exercise 4 Local database usage

In this exercise you are going to modify your program from Lab 3B (Exercise 3.2).  (Or you may start a new program if you wish) Modify your program to create a local database on your hard drive.  Populate the database to contain several records.  The fields of these records are of your choosing.

Your program needs to make use of the database by either looking up information from the database or by archiving data.

Typical databases might be something like this:

Weather database to retrieve data

  • ZIP Code
  • City Name
  • URL string to fetch HTML

Weather database to archive data

  • ZIP code
  • Date
  • Time
  • Temperature

Stock database to retrieve data

  • Ticker symbol
  • URL string to fetch HTML

Stock database to archive data

  • Ticker symbol
  • Date
  • Time
  • Stock Price

Use the information and examples found Chapter 4 of Core Java II  Also  there are more material and examples in Chapter 22 - Core Web Programming (or Chapter 18 - Core Servlets and JavaServer Pages) to help you develop your program.

Lab 4 Notes.

MySQL setup notes.


Lab 5

Exercises

Exercise 5

For this exercise you are to create a servlet that runs locally on your PC.


Lab 6

Exercises

Exercise 6

For this exercise you are to create a servlet that runs on the KaBoom server.


Lab 7

Exercises

Exercise 7

For this exercise you are to create a servlet that generates a graphic and a cookie.


Lab 8

Exercises

Exercise 8

For this exercise you are to create a JSP that runs on the KaBoom server.


Lab 9

Exercises

Exercise 9

Read chapter 8 from Core Java Volume II.  Read chapter 13 from Core Servlets and JavaServer Pages.

For this exercise you are to create a Java bean of your choosing.  Then integrate the bean with a JSP that runs on the KaBoom server.