Laboratory 1: Chapters 2 - 5
Before the lab, do the Self-Review exercises in chapters 2 - 5.
Feel free to talk to whomever you like about any aspect of the laboratory. Working in pairs may be helpful.
Chapter 2
In general, make sure you understand the arithmetic, equality, & relational operator precedence rules. If you have a question, formulate a Java expression (an experiment) that will answer it. Run the program, view its output to get an answer to your question.
Chapter 3
Do exercises 3.16. Instead of making 1 method that returns the target heart rate (a range), create 2 methods, minTargetHeartRate & maxTargetHeartRate, each returning an int. For computing a person's age, use the Calendar class static method to get an instance of a Calendar, which is the current calendar. Then, get the Year: Calendar.getInstance().get( YEAR ). Do not worry about getting this age computation perfect for this lab.
Chapter 4
Do exercises 4.14 - 4.17.
Also, make sure you understand how the meaning of the assignment operators introduced in this chapter:
+= , -= , *= , /= , %=
.
If in doubt, write a Java program whose execution answers your question.
Chapter 5
Make sure you can translate any while statement into a for statement & vice versa. In general, make sure you understand the boolean operators (and, or, exclusive-or, & not) & the precedence rules. Do exercises 5.8 - 5.10, & 5.23.