Question

Exercise 03: Write a program in java that read as input the scores of 3 quizzes of each student (out of 10 as follows) into a 2-D array: Enter the number of students> 4 Enter quiz scores for student 1> 10.0 2.04.0 Enter quiz scores for student 2> 5.5 6.0 6.0 Enter quiz scores for student 3» 8.259.04.0 Enter quiz scores for student 4> 9.5 8.5 2.0 The program then calculates the average of each quiz score for all the students. It then computes a grand average by computing the average of averages The program then decides if a student is Above Average or Below Average as follows: If the majority of students scores are-Grand Average, then thouit le ts elioes eelse the stuso average. Your output Grand Average is 6.229/10.e Student 1 is Below Average Student 2 is Below Average Student 3 is Above Average Student 4 is Above Average

0 0
Add a comment Improve this question Transcribed image text
Answer #1

import java.util.*;

class QuizScores
{
public static void main (String[] args)
{
  Scanner input = new Scanner(System.in);
  
  System.out.println("Enter the number of students> ");
  int num = input.nextInt();
  double avg = 0.0;// initialize grand average
  
  double[][] score = new double[num][3];
  double[] average = new double[num];// average of num students
  
  
  for(int i=0;i<num;i++)
  {
   average[i] = 0.0;
   System.out.println("Enter quiz score for student "+(i+1));
   for(int j=0;j<3;j++)
   {
    score[i][j] = input.nextDouble();// input score
    avg += score[i][j];// grand average
    average[i] += score[i][j];
   
   }
   average[i] /= 3;// compute average of student i
  }
  
  avg = avg/(num*3);
  System.out.printf("Grand Average is %.3f",avg);
  
  for(int i=0;i<num;i++)
  {
   // compare grand average with each student average
   if(average[i] < avg)
   System.out.println("\nStudent "+(i+1)+" is below average ");
   else if(average[i] > avg)
   System.out.println("\nStudent "+(i+1)+" is above average ");
  }
}
}

Output:

Enter the number of students>4
Enter quiz score for student 1   10.0 2.0 4.0
Enter quiz score for student 2 5.5 6.0 6.0
Enter quiz score for student 3   8.25 9.0 4.0
Enter quiz score for student 4 9.5 8.5 2.0
Grand Average is 6.229
Student 1 is below average

Student 2 is below average

Student 3 is above average

Student 4 is above average

Do ask if any doubt. Please upvote.

Add a comment
Know the answer?
Add Answer to:
Exercise 03: Write a program in java that read as input the scores of 3 quizzes...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • In Java Programming: Create a flow chart for a program that prompts for an integer N...

    In Java Programming: Create a flow chart for a program that prompts for an integer N (number of students) and M (number of test scores for each students), and allows the user to N*M real numbers. The program then calculates the average for each student and class average. (1) Prompt the user to input N students and M test scores, then display the inputs. Enter number of students: You entered: 2 Enter number of test scores: You entered: 3 Enter...

  • Question: - write a C++ program that asks user to enter students' quiz scores, calculate the...

    Question: - write a C++ program that asks user to enter students' quiz scores, calculate the total score for each students and average for all. Note: - number of students: 1 through 5. That is, at least one student and up to 5. - number of quizes: 8 through 10. That is, at least 8 quizes and up to 10. - quiz score range: 0 through 100. - when entering quiz scores, if user enters -1, that means the user...

  • - write a C++ program that asks user to enter students' quiz scores, calculate the total...

    - write a C++ program that asks user to enter students' quiz scores, calculate the total score for each students and average for all. Note: - number of students: 1 through 5. That is, at least one student and up to 5. - number of quizes: 8 through 10. That is, at least 8 quizes and up to 10. - quiz score range: 0 through 100. - when entering quiz scores, if user enters -1, that means the user has...

  • (JAVA) Write a program that maintains student test scores in a two-dimesnional array, with the students...

    (JAVA) Write a program that maintains student test scores in a two-dimesnional array, with the students identified by rows and test scores identified by columns. Ask the user for the number of students and for the number of tests (which will be the size of the two-dimensional array). Populate the array with user input (with numbers in {0, 100} for test scores). Assume that a score >= 60 is a pass for the below. Then, write methods for: Computing the...

  • Write a program called printGPA. The program should contain at least 3 methods: main, gradeAverage, and...

    Write a program called printGPA. The program should contain at least 3 methods: main, gradeAverage, and letterGrade. The user will type a line of input containing the student's name, then a number that represents the number of scores, followed by that many integer scores (user input is in bold below). The data type used for the input should be one of the primitive integer data types. Here are two example dialogues: Enter a student record: Maria 5 72 91 84...

  • DESCRIPTION Complete the program using Java to read in values from a text file. The values...

    DESCRIPTION Complete the program using Java to read in values from a text file. The values will be the scores on several assignments by the students in a class. Each row of values represents a specific student's scores. Each column represents the scores of all students on a specific assignment. So a specific value is a specific student's score on a specific assignment. The first two values in the text file will give the number of students (number of rows)...

  • c++ implement a student class Determine the final scores, letter grades, and rankings of all students...

    c++ implement a student class Determine the final scores, letter grades, and rankings of all students in a course. All records of the course will be stored in an input file, and a record of each student will include the first name, id, five quiz scores, two exam scores, and one final exam score. For this project, you will develop a program named cpp to determine the final scores, letter grades, and rankings of all students in a course. All...

  • Write a Java program that reads a file until the end of the file is encountered....

    Write a Java program that reads a file until the end of the file is encountered. The file consists of an unknown number of students' last names and their corresponding test scores. The scores should be integer values and be within the range of 0 to 100. The first line of the file is the number of tests taken by each student. You may assume the data on the file is valid. The program should display the student's name, average...

  • Write a C++ program that asks user number of students in a class and their names....

    Write a C++ program that asks user number of students in a class and their names. Number of students are limited to 100 maximum. Then, it will ask for 3 test scores of each student. The program will calculate the average of test scores for each student and display with their names. Then, it will sort the averages in descending order and display the sorted list with students’ names and ranking. Follow the Steps Below Save the project as A4_StudentRanking_yourname....

  • In C Langage Write a grading program for a class with the following grading policies:- a. There are two quizzes, each gr...

    In C Langage Write a grading program for a class with the following grading policies:- a. There are two quizzes, each graded on the basis of 10 points. b. There is one midterm exam and one final exam, each graded on the basis of 100 points. c. The final exam counts for 50 percent of the grade, the midterm counts for 25 percent and the two quizzes together count for a total of 25 percent. Grading system is as follows:-...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT