Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Calculate the average score for each student and identify the student with the highest average score. Output the number of that student (0-11). Java. Scores

Calculate the average score for each student and identify the student with the highest average score. Output the number of that student (0-11). Java. Scores are read from text file. Please help me figure this out. Thank you in advance!

My code so far:

package com.company; import java.util.*; import java.lang.*; import java.io.*; public class Main { static final int STUDENTS = 12; static final int SCORES = 10; public static void main(String[] args) throws FileNotFoundException { File file = new File("input.txt"); Scanner stdin = new Scanner(file); int[][] quizScores = new int[STUDENTS][SCORES]; for (int student = 0; student < STUDENTS; ++student) { for (int score = 0; score < SCORES; ++score) { quizScores [student][score] = stdin.nextInt(); } System.out.println(); } System.out.println("The scores are: "); for (int students = 0; students < STUDENTS; ++students) { for (int scores = 0; scores < SCORES; ++scores) { System.out.print(quizScores[students][scores] + " "); } System.out.println(); } } } 

text file:

9 8 7 6 7 8 9 8 7 6 8 7 6 5 4 3 5 6 7 8 9 8 7 8 9 9 9 9 9 9 1 2 3 4 5 6 7 7 8 9 2 3 3 5 6 7 7 8 9 9 9 9 9 9 9 9 9 9 9 9 10 10 10 10 10 10 10 9 9 9 7 6 6 6 6 6 6 6 6 4 2 3 5 6 7 8 7 7 6 5 8 9 8 7 6 6 8 9 9 10 3 3 3 8 6 4 5 7 9 2 1 1 1 1 3 2 5 5 2 3 

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional Visual Basic 6 Databases

Authors: Charles Williams

1st Edition

1861002025, 978-1861002020

More Books

Students also viewed these Databases questions

Question

STM 3 2 Bluetooth Home Automation

Answered: 1 week ago