public class ex001 { public static void main(String[] args) { int fre,eng,math,t
ID: 3611507 • Letter: P
Question
public class ex001 {
public static void main(String[] args)
{
int fre,eng,math,total,avg;
String w;
Scanner keyboard = new Scanner(System.in);
do{
do{
System.out.println("please enter the fre score: ");
fre = keyboard.nextInt();
}while(fre < 0 || fre > 100);
do{
System.out.println("please enter the eng score: ");
eng = keyboard.nextInt();
}while(eng < 0 || eng > 100);
do{
System.out.println("please enter math score: ");
math = keyboard.nextInt();
}while(math < 0 || math > 100);
total = fre + eng + math;
avg = total / 3;
System.out.println("total point is " + total );
System.out.println("the average score is " + avg);
System.out.println("Do you want to continue(Y/N): ");
w = keyboard.next();
}while(w == "n");
}
}