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

}
}

Recommended Answers

All 3 Replies

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

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

            }
        }

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.