Patulong po kung pano mag eexit sa loop. Sa line 56, pag NO yung sagot magtutuloy pa din sya. Dapat mag eexit na yon dba? Patulong naman po. Salamat.
View attachment 295049
Code:
import javax.swing.*;
public class finals
{
public static void main(String[] args)
{
String info[][] = new String[1][6];
int num1,num2,num3;
int sum = 0;
double ave;
int selectedOption = JOptionPane.showConfirmDialog(null, "Do you want to log in?","Welcome to Student's Portal", JOptionPane.YES_NO_OPTION);
while(selectedOption == JOptionPane.YES_OPTION)
{
for(int x = 0; x < info.length; x++)
{
info[x][0] = JOptionPane.showInputDialog(null, "Enter your name: ");
JOptionPane.showMessageDialog(null, "Welcome "+info[x][0]+" !","Dota University", JOptionPane.INFORMATION_MESSAGE);
info[x][1] = JOptionPane.showInputDialog(null, "Enter your ID number: ");
info[x][2] = JOptionPane.showInputDialog(null, "Enter your course: ");
for(int y = 0; y < 1; y++)
{
info[x][3] = JOptionPane.showInputDialog(null, "Enter your Prelim Grade: ");
num1=Integer.parseInt(info[x][3]);
info[x][4] = JOptionPane.showInputDialog(null, "Enter your Midterm Grade: ");
num2=Integer.parseInt(info[x][4]);
info[x][5] = JOptionPane.showInputDialog(null, "Enter your Final Grade: ");
num3=Integer.parseInt(info[x][5]);
sum = (num1 + num2 + num3);
}
}
for(int i=0; i<info.length; i++)
{
ave = sum/3;
JOptionPane.showMessageDialog(null,"Name:: "+info[i][0]
+"\nID number:: "+info[i][1]
+"\nCourse:: "+info[i][2]
+"\nPrelim:: "+info[i][3]
+"\nMidterm:: "+info[i][4]
+"\nFinals:: "+info[i][5]
+"\nAverage:: "+ave+"%","Dota University", JOptionPane.INFORMATION_MESSAGE);
}
ave = sum/3;
if(ave > 75)
{
JOptionPane.showMessageDialog(null, "Congratulations!"+"You passed the first semester!","Dota University", JOptionPane.INFORMATION_MESSAGE);
}
else if(ave <=75 )
{
JOptionPane.showMessageDialog(null, "Better luck next time!\n"+"Dota pa bes!","Dota University", JOptionPane.WARNING_MESSAGE);
}
JOptionPane.showConfirmDialog(null, "Compute again?","Welcome to Student's Portal", JOptionPane.YES_NO_OPTION);
}
}
}