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 both a Java application and a Java applet (2 programs), that simulate an ice cream machine. The ice cream machine must print out a random number of ice cream names chosen randomly from a list of at least 8 kinds. Ice cream names must be displayed in a random order and no ice cream can be displayed more than once. The prices of all ice creams are the same, however, it is also random. To get a random number use
You must also
print
For the hierarchy for your
application you can put
Object - YourApplicationClassName
For the hierarchy for your applet you can put
Object - Component - Container - Panel - Applet - YerAppletClassName
Put the applet on one of your web pages.
Hand in by 4pm Sunday May 4 under the door of 1213 EECS:
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 on Wed. May 7 in class, before class starts:
the annotated
hardcopy of your applet code with the URL of the original applet
and the URL of your modified applet.
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 Boats must fit in a bounding box 200 pixels high and 300 pixels
wide. (They don't have to fill the bounding box, they just can't
be bigger than that.) Your Boat should sit on the bottom of the box -
conceptually, floating on the water.
Your Boat must be drawn facing right. (You will not be graded on
your art.)
All your Boat 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 by 4pm Sunday May 11 under the door of 1213 EECS:
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 an error message and continue with the game.
Hand in by 4pm Thursday May 15 under the door of 1213 EECS:
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 either a Swing applet or 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 by 4pm Sunday May 18 under the door of 1213 EECS:
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)
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 on Wed. May 21 in class, before class starts:
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 by 4pm Sunday June 1 under the door of 1213 EECS:
Hardcopy of your project. (Applets must run on the web and applications
must be in your Public directory, so I can run them.)
Anonymous Listener example
(Examples)
How to write Event Handlers
The purpose of this assignment is to give you practice writing event handlers.
Programming assignment:
Add event handling to your project. Make "help" for your project one of
the events that works properly.
Hand in on Wed. June 4 in class, before class starts:
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
How to use the sound API,
Download the sound demo (with source)
Programming assignment:
Add animation to your project.
Hand in by 4pm Sunday June 8 under the door of 1213 EECS:
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:Due Wed. Jun. 11 in class
Add sound, images, colors, and fonts to your project
and be sure it is ready to ship.
Hand in on Wed. Jun. 11 in class in the Media Union:
Hardcopy of your project. (Applets must run on the web and applications
must be in your Public directory, so I can run them.)