Java Reference
In-Depth Information
We also include a method, printHeading , to print the first two lines of the output.
The definition of this method is:
public static void printHeading(PrintWriter outp)
{
outp.println("Course
Course Average");
outp.println("
ID
0
10
20
30
40
50
60
70"
+ " 80 90 100");
outp.println(" |....|....|....|....|....|....|....|"
+ "....|....|....|");
} //end printHeading
If you replace the method printResult in the preceding program, include the
method printHeading , include the statements to output— Group 1 -- **** and
Group 2 -- #### —and rerun the program, then the output for the previous data is as
follows:
Sample Output:
Course
Course Average
7
ID
0 10 20 30 40 50 60 70 80 90 100
|....|....|....|....|....|....|....|....|....|....|
CSC
*****************************************
########################################
ENG
*****************************************
#######################################
HIS
**************************************
##########################################
MTH
*****************************************
##########################################
PHY
*****************************************
#########################################
Group 1 -- ****
Group 2 -- ####
Avg for group 1: 82.04
Avg for group 2: 82.01
Compare both outputs. Which one do you think is better?
Search WWH ::




Custom Search