User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Java section within the Software Development category of DaniWeb, a massive community of 391,713 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,443 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Java advertiser: Lunarpages Java Web Hosting
Views: 1265 | Replies: 3
Reply
Join Date: May 2006
Posts: 1
Reputation: icesnow is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
icesnow icesnow is offline Offline
Newbie Poster

illegal start of expression

  #1  
May 13th, 2006
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
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Aug 2005
Posts: 4,663
Reputation: iamthwee is just really nice iamthwee is just really nice iamthwee is just really nice iamthwee is just really nice 
Rep Power: 16
Solved Threads: 297
iamthwee's Avatar
iamthwee iamthwee is offline Offline
Industrious Poster

Re: illegal start of expression

  #2  
May 13th, 2006
Huh? Was there a question?
Member of: F-ugly code club

Join today don't delay!
Reply With Quote  
Join Date: Mar 2004
Posts: 715
Reputation: Phaelax is on a distinguished road 
Rep Power: 6
Solved Threads: 28
Phaelax Phaelax is offline Offline
Master Poster

Re: illegal start of expression

  #3  
May 13th, 2006
He's got a "illegal start of expression" error in his code.

If you used code tags, it'd be a lot easier to find the answer. Or you could just look at what line number the compiler said the error occurrs on.
Reply With Quote  
Join Date: Jun 2007
Posts: 8
Reputation: j3p0yz is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
j3p0yz j3p0yz is offline Offline
Newbie Poster

Re: illegal start of expression

  #4  
Jun 15th, 2007
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();

}
}
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb Java Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the Java Forum

All times are GMT -4. The time now is 3:15 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC