noobs needing help

Hello everyone out there on the internets. Me and my companions are having a very hard time getting this code to work. We keep getting an "illeagal start of an expression error". I have read all of the other posts about this topic and everyone says that this is usually caused by a misplaced curly brace. We are just too inexperinenced to be able to pick this error out any help would be awesome. The error occurrs on line 43 of the following code. Disreguard the commented code it is for another part of the project.

/**

* AWT Sample application

*

* @Chris Terry

* @version 1.00 07/02/12

*/

import java.text.*;

import javax.swing.JOptionPane;

public class Lunchoneb {

private static double

appleCost,

appleQty,

breadCost,

breadQty,

cheeseCost,

cheeseQty,

wineCost,

wineQty;

// the line below is where we are having the problems!

public static void main(String[] args) {

DecimalFormat df = new DecimalFormat("#0.00");

Lunchoneb();

{

appleCost = 2.51;

appleQty = 2;

breadCost = 1.89;

breadQty = 2;

cheeseCost = 2.79;

cheeseQty = 1;

wineCost = 29.95;

wineQty = 2;

String yourbudgetString;

double budget;

yourbudgetString = JOptionPane.showInputDialog(null, "Enter Your Budget.", "Budget", JOptionPane.INFORMATION_MESSAGE);

budget = Double.parseDouble(yourbudgetString);

}

public static void LunchCost(double totalCost){

//double totalCost;

totalCost = (appleCost * appleQty) + (breadCost * breadQty) + (cheeseCost * cheeseQty) + (wineCost * wineQty);

System.out.println(totalCost);

}

;

//double appleCost = 2.51, appleQty = 2, breadCost = 2, breadQty = 2, cheeseCost = 2, cheeseQty = 1, wineCost = 20, wineQty = 2;

//double totalCost = (appleCost * appleQty) + (breadCost * breadQty) + (cheeseCost * cheeseQty) + (wineCost * wineQty); //Added wine since it was mentioned in class.

//double budget = 74.28;

//double expense = budget - totalCost;

//System.out.println("Price of Apples per pound: $" + df.format(appleCost));

//System.out.println("Price of Bread per loaf: $" + df.format(breadCost));

//System.out.println("Price of Cheese per pound: $" + df.format(cheeseCost));

//System.out.println("Price of Wine per bottle: $" + df.format(wineCost));

//System.out.println("Total Price of all items: $" + df.format(totalCost));

//System.out.println("Your Budget: $" + df.format(budget));

//System.out.println("You have: $" + df.format(expense));

//if (expense < 0) //If statement to determine and display whether you have exceeded your budget.

//System.out.println("You have exceeded your budget.");

//else

//System.out.println("You have not exceeded your budget.");

}

}

[2941 byte] By [kevcavea] at [2007-11-26 18:14:10]
# 1
Repost your code between [code]...[/code] tags, and tell us what line 43 is. We don't want to count.
CaptainMorgan08a at 2007-7-9 5:47:29 > top of Java-index,Java Essentials,New To Java...
# 2
You have the Luncheonb constructor inside the main method.
floundera at 2007-7-9 5:47:29 > top of Java-index,Java Essentials,New To Java...
# 3
And it has a semicolon as well as a brace.
DavidKNa at 2007-7-9 5:47:29 > top of Java-index,Java Essentials,New To Java...
# 4

Ok here goes try number two. Thank you for you patience. Also line 43 is the third section down and it is demarcated by a comment. I hope this is right.

Thanx,

from all the geography nuts in this lab.

Hello everyone out there on the internets. Me and my companions are having a very hard time getting this code to work. We keep getting an "illeagal start of an expression error". I have read all of the other posts about this topic and everyone says that this is usually caused by a misplaced curly brace. We are just too inexperinenced to be able to pick this error out any help would be awesome. The error occurrs on line 43 of the following code. Disreguard the commented code it is for another part of the project.

/**

* AWT Sample application

*

* @Chris Terry

* @version 1.00 07/02/12

*/

import java.text.*;

import javax.swing.JOptionPane;

public class Lunchoneb {

private static double

appleCost,

appleQty,

breadCost,

breadQty,

cheeseCost,

cheeseQty,

wineCost,

wineQty;

public static void main(String[] args) {

DecimalFormat df = new DecimalFormat("#0.00");

Lunchoneb();

{

appleCost = 2.51;

appleQty = 2;

breadCost = 1.89;

breadQty = 2;

cheeseCost = 2.79;

cheeseQty = 1;

wineCost = 29.95;

wineQty = 2;

String yourbudgetString;

double budget;

yourbudgetString = JOptionPane.showInputDialog(null, "Enter Your Budget.", "Budget", JOptionPane.INFORMATION_MESSAGE);

budget = Double.parseDouble(yourbudgetString);

}

//Line 43 is below here this is where we are having problems

public static void LunchCost(double totalCost){

//double totalCost;

totalCost = (appleCost * appleQty) + (breadCost * breadQty) + (cheeseCost * cheeseQty) + (wineCost * wineQty);

System.out.println(totalCost);

}

;

//double appleCost = 2.51, appleQty = 2, breadCost = 2, breadQty = 2, cheeseCost = 2, cheeseQty = 1, wineCost = 20, wineQty = 2;

//double totalCost = (appleCost * appleQty) + (breadCost * breadQty) + (cheeseCost * cheeseQty) + (wineCost * wineQty); //Added wine since it was mentioned in class.

//double budget = 74.28;

//double expense = budget - totalCost;

//System.out.println("Price of Apples per pound: $" + df.format(appleCost));

//System.out.println("Price of Bread per loaf: $" + df.format(breadCost));

//System.out.println("Price of Cheese per pound: $" + df.format(cheeseCost));

//System.out.println("Price of Wine per bottle: $" + df.format(wineCost));

//System.out.println("Total Price of all items: $" + df.format(totalCost));

//System.out.println("Your Budget: $" + df.format(budget));

//System.out.println("You have: $" + df.format(expense));

//if (expense < 0) //If statement to determine and display whether you have exceeded your budget.

// System.out.println("You have exceeded your budget.");

//else

// System.out.println("You have not exceeded your budget.");

}

}

kevcavea at 2007-7-9 5:47:29 > top of Java-index,Java Essentials,New To Java...
# 5
It's because you can't have a method inside of another method. The reason the constructor isn't giving you an error is because you put a semi-colon after it.
CaptainMorgan08a at 2007-7-9 5:47:29 > top of Java-index,Java Essentials,New To Java...
# 6
READ reply #2 and #3.
floundera at 2007-7-9 5:47:29 > top of Java-index,Java Essentials,New To Java...
# 7
> READ reply #2 and #3.Whoa. I was way late.
CaptainMorgan08a at 2007-7-9 5:47:29 > top of Java-index,Java Essentials,New To Java...
# 8
Thanx everyone, and please excuse our noobocity. We really appreciate it.
kevcavea at 2007-7-9 5:47:29 > top of Java-index,Java Essentials,New To Java...