hi..
this is my new program ..
i want a fix or constant answer like,
when the answer in:
Student Name: Monica Clare
then it proceed to another question..
but when..
Student Name: blah blah
then. it shown error_message that it is invalid answer,, ..
please help me debugging this .. thanks ^_^
import javax.swing.*;
import java.util.*;
import java.awt.Graphics;
import java.util.Random;
import java.io.*;
import java.util.regex.Pattern;
import java.util.regex.Matcher;
public class Final
{
public static void main(String args[])
{
String name,student,courses,answer,result,e,f,s="";
do{
Scanner Console = new Scanner(System.in);
name=JOptionPane.showInputDialog("Student Name:");
student=JOptionPane.showInputDialog("Student I.D.:");
courses=JOptionPane.showInputDialog("No. of courses enrolled:");
e=JOptionPane.showInputDialog("Total No. of credit hours:");
f=JOptionPane.showInputDialog("Remaining Bills upon Enrollment:");
result="\n\tStudent Name: "+name+"\n\tStudent I.D.: "+student+"\n\tNo. of courses enrolled: "+courses+"\n\tTotal No. of credit hours: "+e+".";
answer = JOptionPane.showInputDialog("Is tuition paid? [Y/N]:");
if (answer.charAt(0) == 'Y' || answer.charAt(0) == 'y');
else
JOptionPane.showMessageDialog(null,"Paid your Remaining Bill","Warning",
JOptionPane.ERROR_MESSAGE);
}while (answer.charAt(0)=='N' || answer.charAt(0)=='n');
JOptionPane.showMessageDialog(null,result,"Result",
JOptionPane.PLAIN_MESSAGE);
JOptionPane.showMessageDialog(null, "Done", "Done", JOptionPane.INFORMATION_MESSAGE);
}
}