Symbianize Forum

Most of our features and services are available only to members, so we encourage you to login or register a new account. Registration is free, fast and simple. You only need to provide a valid email. Being a member you'll gain access to all member forums and features, post a message to ask question or provide answer, and share or find resources related to mobile phones, tablets, computers, game consoles, and multimedia.

All that and more, so what are you waiting for, click the register button and join us now! Ito ang website na ginawa ng pinoy para sa pinoy!

[HELP]: (Java) exit loop

Status
Not open for further replies.

xxii 22

Amateur
Advanced Member
Messages
125
Reaction score
0
Points
26
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.

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);
		}
	}
}
View attachment 295049
 

Attachments

  • Untitled.png
    Untitled.png
    210.2 KB · Views: 13
Code:
if(JOptionPane.showConfirmDialog(null, "Compute again?","Welcome to Student's Portal", JOptionPane.YES_NO_OPTION) == JOptionPane.NO_OPTION)
                            break;
 
Saan ka po bang school? HAHAHA Curius lang po kasi ako. Parehas po kasi tayo ng pinag aaralan. Dyan nadin po kami e sa JOptionpane. Tapos Prelim Midterm Finals. trisem din po kasi kami ganyan din ginagawa ko sa code mo parehas tayo hahahahaha
 
Code:
if(JOptionPane.showConfirmDialog(null, "Compute again?","Welcome to Student's Portal", JOptionPane.YES_NO_OPTION) == JOptionPane.NO_OPTION)
                            break;
try ko po sir. thank you :)

Saan ka po bang school? HAHAHA Curius lang po kasi ako. Parehas po kasi tayo ng pinag aaralan. Dyan nadin po kami e sa JOptionpane. Tapos Prelim Midterm Finals. trisem din po kasi kami ganyan din ginagawa ko sa code mo parehas tayo hahahahaha
Wesleyan po ako. Magkaiba po tayo ng school kasi trisem kayo. hehehe
 
Actually wesleyan din po ako hahahaha. Ano bang pangalan mo? At anong year kana? hahahaha
 
Ayaw pa din po. Any help. Salamat

- - - Updated - - -

Actually wesleyan din po ako hahahaha. Ano bang pangalan mo? At anong year kana? hahahaha

first year. hahaha
 
Eweng ikaw ba yan? hahahahahahahahahahaha
 
Last edited:
Eweng paturo naman ako. Buti pa ikaw meron na hahahaha. Sige na!!!!!!!!!!!!!!
 
kung gusto mong mag exit sa loop eh gamitin mo yung keyword na break
 
kung gusto mong mag exit sa loop eh gamitin mo yung keyword na break
okay na po code ko. hindi ko na nilagyan ng break. salamat po. close thread ko na. :lock:

- - - Updated - - -

:lock::lock::lock::lock::lock::lock:
 
Status
Not open for further replies.
Back
Top Bottom