Write a simple Java program that prints "Hello, World!" on the command-line.
No write-up is needed for this orientation lab; the main point is to make
sure you are setup with a Java development environment (editing, compiling,
running).
Write a Java program that uses the if or
switch structures to print the song,
"The Twelve Days of Christmas".
The user must be asked to enter a day from 1
to 12, and the program must display the corresponding message for that day.
The strings for each day should only appear in your code once each (e.g., the
string "five golden rings" should only appear in your code once).
Google for the lyrics, or make up your own (keep it clean, please).
Java text (Savitch), p.160-162: choose one of #2, #5, or #8.
(#8: also generate or come up with your own cryparithmetic puzzle)
ch5 (p.328): #4 (use arrays), or #6 (parts one and two), or #7 (parts one and
two).
ch17 (p.999): #1, or #2, or #3.
Feel free to use whatever layout managers you like, but make it reasonably
easy-to-use and not unbearably ugly.
Both of these options require a nice user-friendly Swing GUI: your program
should be reasonably easy-to-use and not unbearably ugly. An average
computer user (non-programmer) should be able to figure out the controls,
even without the help text (which you should also provide).
- Option 1:
(p.1061 #1): Write a Swing GUI program to render a fractal
L-system using a
recursive algorithm. The shape need not be a Sierpinski gasket.
Most fractals have some parameters that can be tweaked (e.g., length of
each branch compared to its parent); provide some kind of interactive
graphical interface to adjust those parameters.
- Option 2:
(p.1063 #2): Write a Swing/Java2D GUI program to read in an image
(need not be colour) and display it. Provide an interactive graphical
interface to adjust the brightness and contrast of the image.
Hint: if the original shade (o) and final shade (f) are floats between
0 and 1, and the brightness (b) is a float between -1 and +1, and the contrast
is a float between 0 and infinity, then one simple way to define
brightness and contrast is by: f = (o+b)*c. The final shade f will need to
be clamped to [0,1]. This method has some bad limitations; you may want to
research better ways to define contrast and brightness.
Come up with your own cool client-server network application (e.g., chat/IM,
stock-ticker, sending pictures, web server)!
- Your application should have
(at least) two running programs, one for the server and one for the client.
- Both should have Swing GUIs that use multithreading to keep the GUI
responsive (non-blocking).
- Your server should use multithreading to handle multiple clients simultaneously (demonstrate this).
- Your application should send something more interesting than just plain-text over the network.
(But it may be a good idea to start with just sending plain-text.)
The point of this is to give you practise working with serialization and ObjectOutputStream et al.
- Be creative!
- The last day of class, Mon 14Apr, you will demonstrate your program
in-class! (the last 10pts of the project)
- To facilitate running the demo, please make it easy to change the server and port,
on both the client and server (e.g., without recompiling).
- Update 4Apr: you can now try your applications on two different computers in the computer lab! Use ports 4410 and/or 4411.