| | |
illegal start of expression
![]() |
•
•
Join Date: May 2006
Posts: 1
Reputation:
Solved Threads: 0
public class GradeSystem {
public static void main (String args[]) {
........
public int searchStu(int id){ // problem happen
int i=0;
for (i=0; i<4; i++) {
if (student[i].getStudentID() == id) return i;}
return i;}
int id;
boolean d;
id = Integer.parseInt(JOptionPane.showInputDialog("Please input ID number : ",
JOptionPane.QUESTION_MESSAGE));
d = Student.isStudent(id);
if (id == 1132810){
int q=0;
do{
id = Integer.parseInt(JOptionPane.showInputDialog("Please input student number : ",JOptionPane.QUESTION_MESSAGE));
d = Student.isStudent(id);
if (d){ int index = searchStu(id);q=2;}
else {
JOptionPane.showMessageDialog(.......); q=1;}
}while(q==1);
teacher.teacherFunction();}
else if (d){
int index = searchStu(id);
Student.studentFunction();}
else
JOptionPane.showMessageDialog(........);
}
} //end main class
public static void main (String args[]) {
........
public int searchStu(int id){ // problem happen
int i=0;
for (i=0; i<4; i++) {
if (student[i].getStudentID() == id) return i;}
return i;}
int id;
boolean d;
id = Integer.parseInt(JOptionPane.showInputDialog("Please input ID number : ",
JOptionPane.QUESTION_MESSAGE));
d = Student.isStudent(id);
if (id == 1132810){
int q=0;
do{
id = Integer.parseInt(JOptionPane.showInputDialog("Please input student number : ",JOptionPane.QUESTION_MESSAGE));
d = Student.isStudent(id);
if (d){ int index = searchStu(id);q=2;}
else {
JOptionPane.showMessageDialog(.......); q=1;}
}while(q==1);
teacher.teacherFunction();}
else if (d){
int index = searchStu(id);
Student.studentFunction();}
else
JOptionPane.showMessageDialog(........);
}
} //end main class
•
•
Join Date: Jun 2007
Posts: 9
Reputation:
Solved Threads: 0
illegal start of expression at public void check() at line 50.. please can anyone help me please..
class waiters
{
private double tab;
public waiters(String name);
{
System.out.println("my name is"+name+",i''ll be your waiter!");
tab = 0.0;
}
public double priceof(String s)
{
double price;
if(s.equals("chicken"))
{price = 5.95;}
else
{
if(s.equals("burger"))
{price = 4.95;}
else
if(s.equals("fries"))
{price = 1.95;}
}
return price;
}
public void order(String s)
{
if(s.equals("chicken"))
{
tab = tab + 5.95;
}
else
{
if(s.eqauals("burger"))
{
tab = tab + 4.95;
}
else
{
tab = tab + 1.95;
}
public void check()
{
System.out.println("Please Pay $");
}
}
public class object4
{
public void main(String [] args)
{
waiter ourwaiter;
ourwaiter = new waiter("jeff");
double x;
double y;
x = ourwaiter.priceof("burger");
y = ourwaiter.priceof("Chicken");
if(x<y)
{
System.out.println("i'll gonna take the burger coz it's cheaper");
ourwaiter.order(burger);
}
else
{
System.out.println("i'll take the chicken");
ourwaiter.order("chicken");
}
System.out.println("and i'll have fries with that");
ourwaiter.order("Fries");
System.out.println("\n eat......\n");
ourwaiter.check();
}
}
class waiters
{
private double tab;
public waiters(String name);
{
System.out.println("my name is"+name+",i''ll be your waiter!");
tab = 0.0;
}
public double priceof(String s)
{
double price;
if(s.equals("chicken"))
{price = 5.95;}
else
{
if(s.equals("burger"))
{price = 4.95;}
else
if(s.equals("fries"))
{price = 1.95;}
}
return price;
}
public void order(String s)
{
if(s.equals("chicken"))
{
tab = tab + 5.95;
}
else
{
if(s.eqauals("burger"))
{
tab = tab + 4.95;
}
else
{
tab = tab + 1.95;
}
public void check()
{
System.out.println("Please Pay $");
}
}
public class object4
{
public void main(String [] args)
{
waiter ourwaiter;
ourwaiter = new waiter("jeff");
double x;
double y;
x = ourwaiter.priceof("burger");
y = ourwaiter.priceof("Chicken");
if(x<y)
{
System.out.println("i'll gonna take the burger coz it's cheaper");
ourwaiter.order(burger);
}
else
{
System.out.println("i'll take the chicken");
ourwaiter.order("chicken");
}
System.out.println("and i'll have fries with that");
ourwaiter.order("Fries");
System.out.println("\n eat......\n");
ourwaiter.check();
}
}
![]() |
Similar Threads
- JAVA Illegal Start of Expression Error (Java)
- Fibonacci Recursion - Illegal Start of expression! (Java)
- illegal start of expression (Java)
- Why illegal start of expression error? (Java)
- illegal start of expression (Java)
- Help on error message, illegal start an ';' expected (Java)
Other Threads in the Java Forum
- Previous Thread: Applet File Permission !!
- Next Thread: System Date Capturing
| Thread Tools | Search this Thread |
actuate add android api applet application applications array arrays automation balls bank binary bluetooth business chat class clear client code codesnippet collections component database defaultmethod development dice digit dragging ebook eclipse equation error event formatingtextintooltipjava fractal functiontesting game givemetehcodez graphics gui health hql html hyper ide idea image infinite int integer invokingapacheantprogrammatically j2me java javame javaprojects jni jpanel julia linux list main map method methods mobile myregfun mysql netbeans nonstatic openjavafx parameter pearl php problem program project recursion repositories scanner scrollbar server set sms sort sorting spamblocker sql sqlserver state storm string sun superclass swing swt thread threads tree windows






