import java.util.*;
public class JavaApplication23{
/**
* @param args the command line arguments
*/
static Scanner console = new Scanner(System.in);
public static void main(String[] args)
{
//creat 5 arrays and declare
String [] Student= new String [10];
int [] Quiz1 = new int [10];
int [] Quiz2 = new int [10];
int [] Quiz3 = new int [10];
int [] Quiz4 = new int [10];
int max , max1 = 0, max2 = 0, max3 = 0, max4 = 0;
int min , min1 = 0, min2 = 0, min3 = 0, min4 = 0;
double average ,average1 , average2 , average3, average4, sum;
String standing;
char letter;
int I ;
double grades;
// read elements to the 5 arrays
for ( I = 0; I < Student.length; I++)
{
// read students name
System.out.print("Enter a student name to the array ");
Student[I]= console.next() ;
System.out.println();
// read Quiz 1
System.out.print("Enter a grade for Quiz1 to the array ");
Quiz1[I]= console.nextInt() ;
System.out.println();
// read Quiz2
System.out.print("Enter a grade for Quiz2 to the array ");
Quiz2 [I]= console.next().charAt(0);
System.out.println();
// read Quiz 3
System.out.print("Enter a grade for Quiz3 to the array ");
Quiz3[I]= console.nextInt() ;
System.out.println();
// read Quiz 4
System.out.print("Enter a grade for Quiz4 to the array ");
Quiz4[I]= console.nextInt() ;
System.out.println();
}
//print out the header of the table
System.out.println();
System.out.println("______________________________________");
System.out.println();
System.out.println("Student\tQuiz1\tQuiz2\tQuiz3\tQuiz14");
System.out.println("______________________________________");
System.out.println();
for ( I = 0; I < Student.length; I++)
System.out.println( Student[I] + "\t" + Quiz1 [I] + "\t" + Quiz2 [I] + "\t" + Quiz3 [I] + "\t" + Quiz4 [I]);
System.out.println();
System.out.println("______________________________________");
// read the max grade of the Quiz1
max1 = Quiz1[0];
for (int i = 0 ; I > Quiz1.length; i++)
if ( Quiz1[i] > max1)
min1 = Quiz1[i];
System.out.println( "Max in Quiz1: " + max1);
// read the max grade of the Quiz2
max2 = Quiz2[0];
for (int i = 0 ; I > Quiz2.length; i++)
if ( Quiz2[i] > max2)
max2 = Quiz2[i];
System.out.println( "Max in Quiz2: " + max2);
// read the max grade of the Quiz3
max3 = Quiz3[0];
for (int i = 0 ; I > Quiz3.length; i++)
if ( Quiz2[i] > max3)
max3 = Quiz3[i];
System.out.println( "Max in Quiz3: " + max3);
// read the max grade of the Quiz4
max4 = Quiz4[0];
for (int i = 0 ; I > Quiz4.length; i++)
if ( Quiz4[i] > max4)
max4 = Quiz4[i];
System.out.println( "Max in Quiz4: " + max4);
System.out.println("______________________________________");
System.out.println();
System.out.println(" ");
// read the min grade of the Quiz1
min1 = Quiz1[0];
for (int i = 0 ; I < Quiz1.length; i++)
if ( Quiz1[i] < min1)
min1 = Quiz1[i];
System.out.println( "Min in Quiz1: " + min1);
// read the min grade of the Quiz2
min2 = Quiz2[0];
for (int i = 0 ; I < Quiz2.length; i++)
if ( Quiz2[i] < min2)
min2 = Quiz2[i];
System.out.println( "Min in Quiz2: " + min2);
// read the min grade of the Quiz3
min3 = Quiz3[0];
for (int i = 0 ; I < Quiz3.length; i++)
if ( Quiz3[i] < min3)
min3 = Quiz3[i];
System.out.println( "Min in Quiz3: " + min3);
// read the min grade of the Quiz4
min4 = Quiz4[0];
for (int i = 0 ; I < Quiz4.length; i++)
if ( Quiz4[i] < min4)
min4 = Quiz4[i];
System.out.println( "Min in Quiz4: " + min4);
System.out.println("______________________________________");
System.out.println();
System.out.println(" ");
// read average of Quiz1
average1 = Quiz1[0];
for (sum = 0 ; I < Quiz1.length; I++)
{
sum = sum + Quiz1[I];
}
average= sum / 10;
System.out.println( "Average of Quiz1 : " + average);
// read average of Quiz2
average2 = Quiz2[0];
for (sum = 0 ; I < Quiz2.length; I++)
{
sum = sum + Quiz2[I];
}
average= sum / 10;
System.out.println( "Average of Quiz2 : " + average);
// read average of Quiz3
average3 = Quiz3[0];
for (sum = 0 ; I < Quiz3.length; I++)
{
sum = sum + Quiz3[I];
}
average= sum / 10;
System.out.println( "Average of Quiz3 : " + average);
// read average of Quiz4
average4 = Quiz4[0];
for (sum = 0 ; I < Quiz4.length; I++)
{
sum = sum + Quiz4[I];
}
average= sum / 10;
System.out.println( "Average of Quiz4 : " + average);
//determine student standing
average= console.nextDouble();
if (average <= 9 & average >= 10 )
standing="Excellent";
else if (average >= 8 & average >= 7)
standing="Good";
else if (average >= 6 & average >= 5)
standing="Satisfactory";
else
standing="Poor";
System.out.println("your average is: " + standing);
}
}
hamdaalblooshi 0 Newbie Poster
stultuske 1,116 Posting Maven Featured Poster
hamdaalblooshi 0 Newbie Poster
stultuske 1,116 Posting Maven Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.