Results 1 to 3 of 3
- 05-03-2012, 11:32 PM #1
Member
- Join Date
- May 2012
- Posts
- 5
- Rep Power
- 0
My NetBeans wont run/compile my code!
[CENTER]
What My Decompiler Reports or Does...Java Code:import java.util.Scanner; public class LunchCounter { public static void main (String[] args) { //Scanner allows user to enter input. Scanner input = new Scanner (System.in); //Declaring doubles of Food Packs, paid in BitCoin; and the double //total. double total; int BitCoinFood1; int BitCoinFood2; int BitCoinFood3; //Printing out statements, and prompting the user for input. System.out.println("How many lunches do you request? : "); System.out.println("If you don't want any lunches, input 0!"); //Stating Lunch Item 1 Prices, and using the ints to declare. System.out.println("Lunch Item 1 - Price: $5.4 BitCoin"); BitCoinFood1 = input.nextInt(); System.out.println("Lunch Item 2 - Price: $6.5 BitCoin"); BitCoinFood2 = input.nextInt(); System.out.println("Lunch Item 3 - Price 7.4 BitCoin"); BitCoinFood3 = input.nextInt(); //Calculating total + display it for user knowledge. total = totalCost(BitCoinFood1, BitCoinFood2, BitCoinFood3); System.out.println("The total BitCoin Owed/Due is: " + total); } //Written method for double totalCost. public static double totalCost(int total1, int total2, int total3) { //Declaring the double's of the total int and amount funding. double total = 0; double amount1 = 5.40; double amount2 = 6.50; double amount3 = 7.40; //Equation for calculating the amount of BitCoin owed/due for food. total = (amount1*total) + (amount2*total2) + (amount3*total3); //Return total; return(total); } }

Any help? This is too pass my Java class btw.. Any help would be greatly appreciated. Thanks.Last edited by DarrylBurke; 05-04-2012 at 07:09 PM. Reason: Removed annoying text formatting
- 05-04-2012, 02:31 AM #2
Moderator
- Join Date
- Feb 2009
- Location
- New Zealand
- Posts
- 4,538
- Rep Power
- 11
Re: My NetBeans wont run/compile my code!
Unless I've missed something, your NetBeans has compiled and is running your program. It appears to be paused, waiting for your input.
If you have any choice in the matter my advice would be don't use NetBeans: compile and run the program from the command line/terminal/console/"dos" prompt. If you don't or are in a big hurry try clicking in that output panel and entrring something. Also use System.out.println() to print useful diagnostic things like "program starting" at the start and "All done!" at the end.
- 05-04-2012, 07:09 PM #3
Similar Threads
-
Able to compile OK, But wont run..Help
By subiedude101 in forum New To JavaReplies: 2Last Post: 02-20-2011, 08:37 PM -
This one wont compile either.. any tips?
By Student101 in forum New To JavaReplies: 9Last Post: 11-18-2010, 05:49 AM -
Why wont this compile?
By Student101 in forum New To JavaReplies: 8Last Post: 11-18-2010, 05:33 AM -
why wont it compile
By bje98f in forum Advanced JavaReplies: 1Last Post: 04-23-2009, 10:55 PM -
simple problem - code wont compile
By dirtycash in forum New To JavaReplies: 1Last Post: 11-20-2007, 05:49 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks