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;
}
}
chie12024
0
Newbie Poster
Recommended Answers
Jump to PostPlease 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.
Jump to PostAh 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 …
All 7 Replies
darkagn
315
Veteran Poster
Featured Poster
chie12024
0
Newbie Poster
darkagn
315
Veteran Poster
Featured Poster
chie12024
0
Newbie Poster
darkagn
315
Veteran Poster
Featured Poster
chie12024
0
Newbie Poster
viswaratha
0
Newbie Poster
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.