CSE10:
Introduction to Computing
Lab work for chapter A: “A Taste of Java”
To get started, go to http://cimel.cse.lehigh.edu/ucsetup in Microsoft Internet Explorer, then select Open to run it. As before, the setup program will install the Java source code and other files, then it will start up the new multimedia. This time select A Taste of Java.
Laboratory work: As you go through the multimedia, it will prompt you to try various interactive and programming exercises. You will learn a lot more if you do some of them! (Note: the multimedia tracks which pages you visit and which exercises you try.) The following exercises supplement the multimedia.
Exercise
A.3: Try
compiling Hello.java. (Assuming you've installed The Universal
Computer, it's in folder C:\ucomp\chapA\Hello. You can open it using BlueJ or JavaEdit.) Do you
get the message?
Exercise
A.4: Modify the content of the string to your name, then recompile and run
the program. (Save your work as HelloMyName.java)
Exercise A.5: What would happen if you tried to compile a program without
the () after
main?
Exercise
A.6: What do you think would happen if you forgot to close a /* comment with a */? (If you’re not sure, try using JavaEdit to compile a program.)
Exercise
A.18: Write a program with statements that prompt the user for his weight
in kilograms and converts it into pounds (instead of pounds to kilograms as in Interactive.java.)
Do you need to do anything different to read in a double value for kilos?
Hint: class Input also has a method getDouble, analogous to getInt only
it returns a value of type double.
Do the above exercises in lab and show your work to a TA before taking
the quiz. (You don’t have to hand
in lab work; just get as much done as you can during lab and show your work to
a TA.) After you have completed your lab
work, you might want to work on your homework for this
week, due Sunday, 9/29.
Before leaving lab today (and you have shown your lab work to a TA), take the quiz!
(You will get a homework assignment that includes exercises from chapter A next week.)