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;
    }


}

Edited 3 Years Ago by Nick Evan: Fixed formatting

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...

Edited 6 Years Ago by darkagn: n/a

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).

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"

This article has been dead for over six months. Start a new discussion instead.