You are on page 1of 1

Java Lab 3: Gradebook – Part 1

1. Create a new class called Gradebook.

2. Add a main method of Gradebook. In the main method, declare and initialize an
array of doubles to store the grades of a student.

3. Write a loop to print out all the grades in the array. Make sure that your printout is
readable with spaces or new lines between each grade.

4. Write a new loop to find the sum of all the grades in the array.

5. Divide the sum by the number of grades in the array to find the student's average.

6. Print a message to the user showing the average grade. If the average grade is 85.4, the
output should be "Your average grade is 85.4".

7. Your program should work if there are 4 grades in the array or 400 grades in the array.
That is, you should be able to change the number of grades in the initialized array and
compile, and it should run without any problems. Try it out. If it doesn't, figure out how
to rewrite your program so it does.

8. (Optional) Add code to print out the letter grade the student earned based on the
average grade. An average in the 90's is an A, in the 80's is a B, 70's is a C, 60's is a D,
and anything lower is an F.

You might also like