A Contest Scoring Program : Y our company has been selected to implement a conte
ID: 3768797 • Letter: A
Question
A Contest Scoring Program:
Your company has been selected to implement a contest scoring program for the upcoming Winter Olympics. Each contestant in the Olympics will compete in five (5) competitions. There will be five (5) contestants. Each competition will be scored on a value of 0 through 10 with 10 being the best and 0 being the worst.
Your job as a programmer is to develop a program to collect (input) the scores for each of the 5 contestants for each of the 5 competitions. (Hint a 2 dimensional array => 5 X 5)
Your program will determine the highest score for that completion and display the number of the winner (1 through 5). (Hint: find the largest value in each column). In addition, your program should total up the total scores for the contestants and award 1st place for the overall winner. (Hint: Sum up each rowand find the largest value)
Your main program will prompt for each contest and allow the entry of the scores for each contestant. For example:
Contest #1
7.5 9.3 8.5 7.2 10.0
Contest #2
8.1 7.8 9.2 10.0 7.7 8.5
Contest #3
………….
Contest #4
………….
Contest #5
………….
The winner for Contest #1 is number 5
The winner for Contest #2 is number 3
The winner ……
The winner ……
The winner ……
The 1st place winner is number XX
Explanation / Answer
import java.util.*;
class Contest
{
int score[]= new score [5];
int i, sum=0;
System.out.println("Eneter the value of i contestants number");
Scanner sr= new Scanner(System.in);
i = sr.nextInt();
int max = score.get(0);
for(int con=1; con<=i; con++) {
System.out.println("contestant"+con+"scores are: ");
for(score=0;score<=5;score++){ // score of contestant
System.out.println(" ");
for( int j : score[i]) {
sum + = j;
}
if (score.get(i) > max) {
max = score.get(i);
}
}
System.out.println(score);
System.out.println(sum);
System.out.println(max);
}
public static void main(String[] args)
{
System.out.println("Hello World!");
Contest ct = new Contest();
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.