Programming assignment:
The purpose of this assignment is to introduce you to beginning
Java programming concepts and to get you to
learn how to edit, compile, and print Java source
code files,
how to run Java applications, how to run Java applets,
and to learn how to print the output
of your Java applications and applets.
Write a Java application, using the class style, similar to the
HelloWorldApp.java in the tutorial
that will print your name and three lines
each showing how a different Java operator works.
For the hierarchy for your
application you can put
Object - YourApplicationClassName
Write a Java applet, using the class style, similar to the
HelloWorld.java applet in the tutorial
that will print your name and three lines
each showing how a different Java operator works.
on one of
your web pages.
For the hierarchy for your applet you can put
Object - Component - Container - Panel - Applet - YerAppletClassName
Hand in:
Programming assignment:
The purpose of this program is to give you a chance to look at other people's
Java code, and see how they organize their classes and use the API,
and also to give you some ideas
about possible projects you might want to do for the class.
Hand in:
the annotated
hardcopy of your applet code with the URL of the original applet
and the URL of your modified applet.
Important changes to the assignment
Programming assignment:
The purpose of this program is to give you an opportunity to practice
using inheritance, polymorphism, abstraction, and encapsulation; and
graphics.
(1)Write two subclass of the
class designed in lecture.
Each subclass must have at least one new instance variable.
All Monsters must fit in a bounding box 300 pixels high and 300 pixels
wide. (They don't have to fill the bounding box, they just can't
be bigger than that.) Your Monster should stand on the bottom of the box -
conceptually, standing on the ground.
Your Monster must be drawn facing right. (You will not be graded on
your art.)
All your Monster subclasses must have a default constructor - a constructor
that takes no parameters.
Include at least 2 constructors for each of your new classes
(one should be a default constructor)
and access methods
for the new data, if appropriate.
(2) Write a Java application
that creates at least one instance of each class you wrote
and prints out the values of all the variables (using the access methods)
for each instance.
(3) Write a Java applet that draws
at least one object from each of your classes.
Think about what you want to do for your project for the rest of the course. (You can have 1 partner for the project, but not for this assignment.)
Hand in: Hardcopy of your new subclasses, your application, your applet and output from your application.
Example applet Exception
More Examples
Programming assignment:
The purpose of this program is to give you an opportunity to practice
using Java operators, control structures, and exceptions.
Write an application that plays a number guessing game with the user. Your program should pick a random integer and ask the user to input a guess, using JOptionPane.showInputDialog(null, ... ) (You will need to import javax.swing.* to use this method.) Use Integer.parseInt( ... ) to turn the String into an int. Tell the user if their guess is too high, too low, or correct. Keep asking the user for input until they guess the number. If the user inputs something other than a number, give them an error message and continue with the game.
Hand in:
Hardcopy of the application.
Assignment:
The purpose of the first part of this assignment is to help you get a feel
for how applets run in
a browser and to help you understand the purpose for each of the
applet methods. Do the first part by yourself - no partner.
The purpose of the second part is to have you develop the
first draft of your project design. If you are going to have a partner,
you must do it together. (Hand in one copy with both names on it.)
The form handed out in class contains a list of different things you can do to an applet while it is running, e.g., move to a different page, scroll the page, etc. On the form mark which methods are called for each thing you do. You must make up the last 5 yourself. The ones you make up must be different from the ones I put on the form. Use the ExtendedSimple applet to find out which methods are called. (You can find the version of the browser in the Help menu.)
Decide on a project to work on for the rest of the class. You will write both an AWT applet and a Swing application. It can do anything you want, but it must
Prepare a program header for your project and a rough drawing of the graphical user interface (GUI).
Hand in:
The form describing the
things you tried while running the ExtendedSimple applet and
which methods were called for each.(do this yourself)
The program header describing your project and the GUI drawing.(do this
with your partner, if you have one)
How to use AWT components
How to use Swing components
Programming assignment: Students! Start your projects! For this assignment, add at least one of the components you will need. The components must show up, but they don't have to do anything. They also don't have to be in the proper place.
Hand in:
Hardcopy of your project. (Applets must run on the web and applications
must be in your Public directory, so I can run them.)
Programming assignment: Continue working on your GUI. Use the proper layout managers and containers so your GUI is formatted the way you want it.
Hand in:
Hardcopy of your project. (Applets must run on the web and applications
must be in your Public directory, so I can run them.)
Programming assignment:
Add event handling to your project. Make "help" for your project one of
the events that works properly.
Hand in:
Hardcopy of your project. (Applets must run on the web and applications
must be in your Public directory, so I can run them.)
Images and animation
Sound in Java 1.3,
How to use the sound API,
Download the sound demo (with source)
Programming assignment:
Add sound, images, colors, and fonts to your project.
Hand in:
Hardcopy of your project. (Applets must run on the web and applications
must be in your Public directory, so I can run them.)
Programming assignment:
Add animation to your project and be sure it is ready to ship.
Hand in
Hardcopy of your project. (Applets must run on the web and applications
must be in your Public directory, so I can run them.)