Question: My output must match the example given below: I am writing this code in Java and must read and print from a file. Must use

My output must match the example given below: I am writing this code in Java and must read and print from a file. Must use arrays. Must use methods to sort, print tabular results, use the

same method to print both competitor table. Thanks.

Results of the Rocking JR Fishing Contest

Competitor Total

Number Weight

1 14.75

2 34.60

3 7.30

4 26.45

5 19.00

6 28.50

7 18.75

Winner is

2 34.60

Contest Rankings

Competitor Total

Number Weight

2 34.60

6 28.50

4 26.45

5 19.00

7 18.75

1 14.75

3 7.30

Contest Over

Data given is:

6 3.7 7 4.51 2 12 1 7.3 6 3.6 7 11.1 2 6.41 7 6.2 4 7.3 3 3.7 2 2.3 1 7.3 3 3.6 7 11.1 6 6.41 3 6.2 5 3.7 2 8.65 7 10.5 5 7.2 4 13.75 2 5.3 1 7.45 7 4.35 2 4.6 5 10.4 2 8.25 4 8.7 3 9.35 5 8.1 3 6.7 4 2.5 1 2.6 5 3.7 6 5.8 1 4.9 5 3.7 2 8.65 7 10.5 5 7.2 1 7.9 4 13.75 6 5.3 1 7.45 5 3.37 7 4.35 2 4.6 5 17.4 7 8.25 4 12.7 2 9.35 6 8.25 5 8.1

Code I have done so far, using BlueJ:

import java.util.Scanner; import java.io.*; class FishingContest { int largestWeight(int competitor[], double weight[]) { double largest = weight[0]; int position=competitor[0]; for(int i=1;iweight[i]) { smallest=weight[i]; position=competitor[i]; } return position; } void printResults(int competitor[], double[] weight) throws IOException { PrintWriter pw = new PrintWriter(new FileWriter("7bResults.txt")); //pw.printf(%n); pw.printf("Results of the Rocking JR Fishing Contest%n"); pw.printf("Competitor\tTotal%n"); pw.printf(" Number \tWeight%n"); for(int i=0;i

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!