import java.io.*;
public class EggTrader
{
    public static void main(String[]args) throws IOException{   
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

    int numofEggs,EggCount,Cash;
    double cashOnHand = 500;
    double pricePerdozen = 72;
    double unitPrice;


    public void buyOneDozen(double pricePerdozen)
    {
        numofEggs = Integer.parseInt(br.readLine());
        numofEggs = getEggCount(numEggs,cashOnHand);
    }
    public void sellEggs(int numEggs,double unitPrice)
    {
        numofEggs = Integer.parseInt(br.readLine());
        numofEggs = getCashOnHand(cashOnHand,pricePerdozen);
    }

    public static int getEggCount()
    {
        numofEggs = (numEggs+cashOnHand);
        System.out.println("Number of Eggs: "+numEggs);
        return eggCount;
    }
    public static double getCash()
    {
        numofEggs = (cashOnHand+unitPrice);
        System.out.println("Cash On Hand: "+cashOnHand);
        return cashOnHand;
    }


}

Recommended Answers

All 7 Replies

Please use code tags. What line is the error reported on?

I suspect the error has to do with the fact that you name your member variable numEggs but then refer to it as numOfEggs in the rest of your code.

the error says.. illegal start of expression.. in this line.

public void buyOneDozen(double pricePerdozen);

Ah ok, remove the semicolon. In java you declare a method like so:

public void buyOneDozen(double pricePerdozen)
{
   // method functionality goes here
}

You will similarly need to remove the other semicolons after your other method declarations.

EDIT: Also, you are declaring those methods inside your main method. I don't know that this is what you want to do...

I removed the semicolon,but still says. illegal start of expression >_<

Sorry you may have missed my edit, you need to change where you are declaring your methods (that is, not inside your main method).

ohh okay,
i get it.. tnx ^^

I suggest you do not use complicated variable names because JAVA is a case sensitive language. Try using simpler variables.
The 6th line of your code say "numofEggs"
and the 20th and 21st line say "numEggs"

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.