Instructions: Answer as many of the following questions as you can during the lab period. If you are unable to complete the assignment during the lab period it is strongly recommended that you complete it on your own.
Getting Ready: Before going any further, you should:
Example1.java
in the editor.
double
variable named avg
.
LetterGrade
variables named
cs139
and cs239
.
cs139
and the grade B to
cs239
(using the enumerated type
LetterGrade
).
System.out.printf("Grade in CS139: %s\n", formatGrade(cs139));
System.out.printf("Grade in CS239: %s\n", formatGrade(cs239));
System.out.flush();
Example1.java
cs139
and
cs239
and outputs either "I did better in CS239 than
in CS139\n", "I did worse in CS239 than in CS139\n", or "I got the
same grade in CS239 and CS139\n".
pointsGrade()
method).
LetterGrade.java
in the editor and make sure
you understand it.
Example2.java
in the editor.
toPoints()
method to LetterGrade
that returns the points
attribute.
toString()
method to LetterGrade
that returns the symbol
attribute.
Example2.java
so that it outputs the grades in
the two courses in the same format as in Example1.java
.
Example2.java
so that it calculates the
average and outputs it in the same format as in
Example1.java
.
Example2.java
so that it uses an array of two
LetterGrade
objects rather than the variables
cs139
and cs239
.
Example2.java
to Example3.java
.
Example3.java
in the editor.
Example3.java
so that it uses an array of 1000
LetterGrade
objects, only assigning values to elements
139 and 239.
Example3.java
is a good or bad? Why?
Copyright 2007