Program #2
Due Friday, Feb.2, 2:00 pm
Purpose
The objectives for this assignment are to:
-
Create an externally defined class
-
Input from HTML
-
Input from the keyboard
-
Use Java AWT features
-
To write a class that will be used to create objects in another class
Description
You will be writing an applet that responds to input from an HTML and creates
an object based on this input. To accomplish this, you will need to work with
some of the Java AWT classes.
Assignment
Write an Applet that reads parameters from an HTML file. These parameters
are mostly the same parameters used in the previous assignment: the book's
title, publisher's name, author's name, ISBN. But there is
no year in this assignment. You will be using features of the Abstract
Window Toolkit to display this information.
Details
You can use this Book.java file , or the
class you created for program 1, **but without the year instance variable**.
You will need the following editable text fields:
-
The Book Title
-
The Publisher Name
-
The Author Name
-
The ISBN
In the output area, be sure to label which field is which. For the editable
text fields, you may choose either the TextArea or the TextField class.
The fact that the above fields are editable means you need to support editing.
That is, if someone types in a different book title, it should be changed
in the book's instance variable.
We will also be looking for the following style types of things in your
program (these should be in every program!):
-
A comment at the beginning of the file describing the general purpose of
the file
-
Comments within the code (not on every line), more for things that a bit
more complicated -- remember that you want to know what this program does
when you go back and look at it a few years later.
-
Each method should have a comment (generally before the method) that describes
the purpose of the method.
-
Choose your variables so you and others will understand their purpose (for
example int x is generally not a good name, it does not tell much
about what x does; counter would be better if you are using it as a counter
somewhere in the program).
-
Use Indentation and spacing for greatest readability (this is very important
for understandability of code!).
Turn In
Turn in electronically by 2:00pm 2/2/2001:
-
Your Book.java file
-
Your Applet Java program which must be named BookApplet.java
-
Your HTML file which must be named BookApplet.html