hello sir!!!
i need the answer as soon as possible!! can you change this code and execute it using the JOptionPane... Please help me!!! You may send your answers to this address... <snip email>
Thanks a lot!!!
import java.io.*;
public class ToyoradaII
{
public static void main(String []lyn)
throws IOException
{
String choice;
InputStreamReader stream=new InputStreamReader(System.in);
BufferedReader read=new BufferedReader(stream);
int grades[]=new int[10];
int num=1;
String str;
do{
System.out.println("+-----------------------------------+");
System.out.println("|NOTE 1:NO GRADES BELOW 50 0R HIGHER|\n|\t\tTHAN 100 SHALL BE ENTERED! |");
System.out.println("+-----------------------------------+");
System.out.println("+---------------------------------------+");
System.out.println("THIS PROGRAM ACCEPTS ONLY WHOLE NUMBERS!|");
System.out.println("+---------------------------------------+");
int x=0;
while(x<10)
{
do{
System.out.println("\n");
System.out.print("Student "+num+":");
str=read.readLine();
grades[x]=Integer.parseInt(str);
if(grades[x]<50)
{
System.out.println("GRADE BELOW 50 NOT ALLOWED! \n\tEnter another. . . ");
}
if(grades[x]>100)
{
System.out.println("OVERWHELMING GRADE!\n\tEnter another. . .");
}
}
while(grades[x]<50||grades[x]>100);
num++;
x++;
}
System.out.println("+------------------+");
int Hi_Grade;
int y=0;
while(y<grades.length-1)
{
if(grades[y]>grades[y+1])
{
Hi_Grade=grades[y];
grades[y]=grades[y+1];
grades[y+1]=Hi_Grade;
}
y++;
}
System.out.println("\n\nHIGHEST GRADE: "+grades[9]);
int Low_Grade;
int z=0;
while(z<grades.length-1)
{
if(grades[z]<grades[z+1]){
Low_Grade=grades[z];
grades[z]=grades[z+1];
grades[z+1]=Low_Grade;
}
z++;
}
System.out.println("\nLOWEST GRADE: "+grades[9]);
int Average=0;
int ave=0;
while(ave<grades.length)
{
Average+=grades[ave];
ave++;
}
Average=Average/10;
System.out.println("\nAVERAGE GRADE: "+Average);
System.out.println("\n\nGRADE DISTRIBUTION: ");
int dist1=0;
int a=0;
while(a<grades.length)
{
if(grades[a]>=50&&grades[a]<=60)
{
dist1++;
}a++;
}
System.out.print("\n50-60 : ");
int b=0;
while(b<dist1)
{
System.out.print("*");
b++;
}
int dist2=0;
int c=0;
while(c<grades.length)
{
if(grades[c]>=61&&grades[c]<=70)
{
dist2++;
}c++;
}
System.out.print("\n61-70 : ");
int d=0;
while(d<dist2)
{
System.out.print("*");
d++;
}
int dist3=0;
int e=0;
while(e<grades.length)
{
if(grades[e]>=71&&grades[e]<=80)
{
dist3++;
}e++;
}
System.out.print("\n71-80 : ");
int f=0;
while(f<dist3)
{
System.out.print("*");
f++;
}
int dist4=0;
int g=0;
while(g<grades.length)
{
if(grades[g]>=81&&grades[g]<=90)
{
dist4++;
}g++;
}
System.out.print("\n81-90 : ");
int h=0;
while(h<dist4)
{
System.out.print("*");
h++;
}
int dist5=0;
int i=0;
while(i<grades.length)
{
if(grades[i]>=91&&grades[i]<=100)
{
dist5++;
}i++;
}
System.out.print("\n91-100: ");
int j=0;
while(j<dist5)
{
System.out.print("*");
j++;
}
System.out.println("\n+------------------------------+");
System.out.print("|WANT TO DO IT AGAIN? [YES][NO]|");
System.out.println("\n+------------------------------+");
choice=read.readLine();
if(choice.equalsIgnoreCase("yes"))
num=1;
}while(choice.equalsIgnoreCase("yes"));
}
}