Java程序辅导

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

客服在线QQ:2653320439 微信:ittutor Email:itutor@qq.com
wx: cjtutor
QQ: 2653320439
Lab 5 
In this lab you will be creating two classes opposed to one class as in previous labs 
First class: name this class "TestScores" and copy and paste the code from my website. You will not be 
adding code, removing code or editing ANY code from this class. All work for this lab will be accomplised 
inside your second class, TestScoresAverage.java 
Second class: name this class "TestScoresAverage" , and make sure this class is in the same project 
folder as your TestScores.java class. Coding this class is left to you! 
Steps for creating TestScoresAverage.java 
1. This class has NO default constructor and NO access methods. The access methods and constructor 
for this class are already coded for you in your TestScores.java class. The class TestScoresAverage.java is 
able to use the constructor, variable and methods from the TestScores.java class because they are in the 
same project. Code for TestScoresAverage.java will be mostly implemented within its main method. 
2. Below please find an algorithm for TestScoresAverage. Each step of the algorithm represents one line 
of code. At this point you should be able to read my specification (algorithm) below and translate it to 
working java code. 
ALGORITHM  
1. You need to import the Scanner java library, this will allow you to read input from the user 
2. Below your import statement use a multi-line comment to document your name, lab, and date 
3. Below your comment block AND import statement keyboard type the code which will create a public 
class named TestScoreAverage. Don't forget to use open and closed brackets. 
4. Inside your TestScoreAverage class keyboard type the code to create your main method. Remember 
all main methods follow the same format. That is, public static void main(String[] args). Again, don't 
forget your open/closed brackets. 
5. At this point all your remaining code should be keyboard typed inside your main method ONLY. You 
do not need any access methods nor constructor for this class. Remember we are going to use the 
constructor and access methods from TestScores.java 
6. Inside your main method declare three variables (test1, test2, test3) whose data type is a double. 
7. Next, create a scanner object for keyboard input. 
8. Keyboard type the code which will prompt the user to enter test score one.  
9. Store the input from the user in test1 
10. Repeat steps 7-9 prompting users for test score 2 and test score 3 and storing the user input in 
variables test2 and test3, respectively. 
11. Next, keyboard type the code in your main method which will create a new TestScores object named 
scores with test1,test2 and test as its parameter variables  
NOTE: Step 11 makes a call to the default constructor in TestScores.java class. We are able to call this 
constructor from the main method in TestScoresAverage.java class because they are in the same project 
folder and the classes are public to one another. 
12. Display to the users the average of the three test scores (test1,test2 and test3) 
NOTE: the above means we want to get the average scores (hint) for the scores object (hint) we created 
in step 11. 
13. Comment your code 
14. Demo to TA 
15. Submit TestScores.java to portal for grading.