Java程序辅导

C C++ Java Python Processing编程在线培训 程序编写 软件开发 视频讲解

客服在线QQ:2653320439 微信:ittutor Email:itutor@qq.com
wx: cjtutor
QQ: 2653320439
Java Lab 3: GradeBook – Part 1                                              Thursday, June 17, 2004 
 
Read instructions carefully! Following instructions is part of the grade for this lab. 
Please do not hesitate to ask any of the team members for clarifications. 
  
This lab is due at 5pm today, at which point solutions will be posted at a location to be 
announced to the class. Make sure you read through the entire lab before attempting any 
of the parts to manage your time appropriately. 
 
In this lab, we will be introducing the JCreator IDE, which is already installed in your 
machines. It is therefore necessary to read through the JCreator Primer before 
attempting any of the parts in this lab. All students are required to write and compile 
code using JCreator from now on. 
 
0. Create a new folder named lab3 in the folder C:\java\lastName (where lastName is the 
variable that stores your last name). This is the folder to which you will be saving all the 
files required for this lab. 
 
1. (2 points) Create a new class called GradeBook. Add a main method to 
GradeBook. You should put the code required to complete all the subsequent parts 
of this lab in this method.  Declare and initialize an array of doubles to store the 
grades of a student.  For this lab, you can assume that all grades fall in the range between 
0 and 100. 
 
2. (3 points) Write a loop to print out all the grades in the array in part 1. Make sure that 
your printout is readable with spaces or new lines between each grade. For example if the 
grades are 10.5, 20.5 and 40.5, your output should be of the form “The grades are 10.5 
20.5 40.5”.  
 
3. (2 points) Write a new loop to find the sum of all the grades in the array. Print a 
message to the user showing the total grade. If the sum is 170.8, the output should be 
"Your total grade is 170.8". 
 
4. (1 point) Divide the sum by the number of grades in the array to find the student's 
average. 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". 
 
5. (2 points) Your program should work regardless of the number of grades in the grades 
array. That is, you should be able to change the number of grades in the initialized array 
and compile, and it should print out the correct sum and average grades. Try it out. If it 
doesn't work, figure out how to rewrite your program so it does. 
 
6. (Optional – 2 points) 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.  
 
7. CheckOff 
Please ensure that you have the file GradeBook.java in the folder named lab3 that you 
created in step 0.  
 
If you are ready to be checked off before 5pm, call one of the team members who will 
assign you a grade for the lab. Otherwise, you may leave the required files on your 
machine for us to evaluate at our own convenience.  
 
We will not accept modifications to the required files after the lab is officially due.