In: Computer Science
Create a java program that will do the following:
Create a method called getInt.Allow the user to enter up to 20 student names,and for each student 3 quiz scores (in the range 0-100). Once input is done, display each student’s name, their three quiz scores, and their quiz score average, one student per line. The output table does not need to line up perfectly in columns.Use dialog boxes for all input and output.Use the method to input the three scores.Parameter 1 is a String, used for the input prompt (example:“Enter the number of objects ordered"). Use 5 arrays, one for the names, 3 for the scores, and one for the average.Write a method that takes three values and returns their average, and use this to calculate each student’s average.
package as1;
import java.util.Scanner;
public class Application2 {
public static void main(String[] args) {
int i=0;
Scanner sc=new
Scanner(System.in);
System.out.println("enter number of
students ");
int number=sc.nextInt();
String[] student_name=new String[number];
int [] quiz1=new int[number];
int[] quiz2=new int[number];
int[] quiz3=new int[number];
float avg[]=new float[20];
while(i<number){
System.out.println("enter student name");
String
name=sc.next();
student_name[i]=name;
///System.out.println(student_name[i]);
System.out.println("enter first quiz score");
int
quiz_score1=sc.nextInt();
quiz1[i]=quiz_score1;
System.out.println("enter second quiz score");
int
quiz_score2=sc.nextInt();
quiz2[i]=quiz_score2;
System.out.println("enter third quiz score");
int
quiz_score3=sc.nextInt();
quiz3[i]=quiz_score3;
// for
average
avg[i]=((quiz1[i]+quiz2[i]+quiz3[i])/3);
i++;
}
System.out.println("name quiz 1
quiz 2 quiz 3 average ");
for(int
j=0;j<=number-1;j++){
System.out.println(student_name[j]+" "+quiz1[j]+" "+quiz2[j]+"
"+quiz3[j]+" "+avg[j] );
}
}
}