Due date is the beginning of your lab section next week:
Lab prep: Read this lab assignment.
Written Exercises: Read CS (Brookshear) chapter 1 through section 1.5, write up these exercises, and turn them in along with your lab work.
This lab will introduce you to the DrJava IDE (integrated development environment) and to programming using the Java language. You are encouraged to discuss the assignment with other students, but you must write your own code. At the top of the first page of your submission, write your own name and the names of the students with whom you discussed the assignment. (Some of the exercises below are from the Reges and Stepp text.)
For each program that you write, be sure to include comments at the beginning indicating your name, your lab section, the exercise number, and what the program does. Please turn in a printout of your Java source file for each program that you write, and please make sure all pages are stapled together.
Click on the "Compile" button, and assuming there are no syntax errors, click on the "Run" button to see the text output in the Interactions pane below. (If there are syntax errors, you will need to correct them and recompile.) Change the program to output a text string of your choice, recompile, and rerun to make sure you changed the program properly. Turn in a printout of your revised Hello.java program.
A well-formed Java program has
a main method with { and }
braces.
A System.out.println statement
has ( and ) and usually a
String that starts and ends
with a " character.
(But we type \" instead!)
Old MacDonald had a farm E-I-E-I-O And on his farm he had some chicks E-I-E-I-O With a cluck-cluck here And a cluck-cluck there Here a cluck, there a cluck Everywhere a cluck-cluck Old MacDonald had a farm E-I-E-I-O Old MacDonald had a farm E-I-E-I-O And on his farm he had some cows E-I-E-I-O With a moo-moo here And a moo-moo there Here a moo, there a moo Everywhere a moo-moo Old MacDonald had a farm E-I-E-I-O Old MacDonald had a farm E-I-E-I-O And on his farm he had some sheep E-I-E-I-O With a baa-baa here And a baa-baa there Here a baa, there a baa Everywhere a baa-baa Old MacDonald had a farm E-I-E-I-O
On the first day of Christmas, my true love sent to me a partridge in a pear tree. On the second day of Christmas, my true love sent to me two turtle doves, and a partridge in a pear tree. ... On the twelfth day of Christmas, my true love sent to me Twelve drummers drumming, eleven pipers piping, ten lords a-leaping, nine ladies dancing, eight maids a-milking, seven swans a-swimming, six geese a-laying, five gold rings; four calling birds, three French hens, two turtle doves, and a partridge in a pear tree.
Back to Computer
Science 101 Home
Department of Computer
Science