Java程序辅导

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

客服在线QQ:2653320439 微信:ittutor Email:itutor@qq.com
wx: cjtutor
QQ: 2653320439
Java Lab 7: GradebookOO – Part 3                           Wednesday, June 23, 2004 
 
Read instructions carefully! Following instructions is part of the grade for this lab.  
 
This lab is due at 5pm today, at which point solutions will be posted at a location to be 
announced to the class. Having the lab due at 5 pm implies that you should save all your 
files and leave your machine by 5 pm. Failure to turn in the lab promptly at 5 pm will 
be penalized by taking off 1 point.  
 
Make sure you read through the entire lab before attempting any of the parts to manage 
your time appropriately. For this lab, we will also be grading the neatness of and 
comments in your code. Please look over the solutions that we give you for guidelines on 
how to present your code. 1 point will be taken off for code that is not neat or has no 
comments. 
 
0. In this lab, you will continue working on the files GradeBookOO.java and 
GBProgram.java that you created for lab 5. You therefore need not create a new folder or 
file to complete this lab. However, please ensure that we have checked you off for lab 6 
and that you have corrected all the mistakes that we pointed out for that lab before you 
start working on today’s lab. 
 
1. (1 point) Change the field in the GradebookOO program from an array to an 
ArrayList. 
 
2. (8 points) Rewrite all the methods in the two classes to use the ArrayList instead of 
the array.  Make sure you use an Iterator for all the iterations through the 
ArrayList. Compile. 
 
3. (1 point) Do you have to make any changes to GBProgram so that it will compile and 
run successfully? Explain why or why not in a file named lab7.txt. 
 
4. (5 points) Run GBProgram. This is the final version of the GradeBookOO 
application. In order to get full credit, your program should be able to accept grades 
passed in from the command line when called appropriately and print out all the grades 
and the average grade. For example, typing in  
 java GBProgram 80.0 90.0  
from the command line should give the output: 
           The Grades are: 80.0 90.0 
           The average grade is: 80.5   
 
We will also award 3 extra points for students who have implemented the optional part of 
the lab that interacts with the user. 
 
6. CheckOff  
Please ensure that you have the files GradeBookOO.java , GBProgram.java and 
Lab7.txt in the folder named lab5. These files should compile successfully. Failure to 
compile will automatically cost you 1 point.   
  
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 should 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.