954,536 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Illegal start of expresion

illegal starts of expression. public check() at line 50. can anyone hepl 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

j3p0yz
Newbie Poster
9 posts since Jun 2007
Reputation Points: 10
Solved Threads: 0
 

I'm sorry, but start your own thread, don't hijack someone else's.

masijade
Industrious Poster
Moderator
4,253 posts since Feb 2006
Reputation Points: 1,471
Solved Threads: 494
 

Just reformat the code and the error will be glaring in your face.
Use Astyle e.g.
Also use the code tags:

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();

            }
        }
thekashyap
Practically a Posting Shark
811 posts since Feb 2007
Reputation Points: 254
Solved Threads: 75
 

Also, it has been requested of the poster that he use code tag at least 5 times and yet he still refuses.

Ezzaral
Posting Genius
Moderator
15,986 posts since May 2007
Reputation Points: 3,250
Solved Threads: 847
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You