okay so everything compiles BUT i have been stuck on why it doesnt work for days. When I compile it says " ----jGRASP: process aborted by user.
----jGRASP exec: java Conversion
Wht am I doing wrong?
import java.util.Scanner; import java.text.DecimalFormat; public class Conversion { DecimalFormat formatter = new DecimalFormat("##0.0000"); public static void main(String[]args) { showMenu(); } public static void showMenu() { double meters = 0.0; Scanner keyboard = new Scanner(System.in); do { meters = keyboard.nextDouble(); if (meters<0) System.out.println("Please enter a positive number"); meters=keyboard.nextDouble(); } while (meters>0); menu(meters); } public static void menu(double meters) { int selection=0; Scanner keyboard = new Scanner(System.in); while(selection !=4) { System.out.println("METER CONVERSION"); System.out.println("1) Convert to Kilometers"); System.out.println("2) Convert to Inches"); System.out.println("3) Convert to Feet"); System.out.println("4) Quit the Program"); System.out.println("Please make a selection:"); selection = keyboard.nextInt(); switch(selection) { case 1 : showKilometers(meters); System.out.println("Please enter the number of meters you want to convert:"); meters=keyboard.nextDouble(); break; case 2: showInches(meters); System.out.println("Please enter the number of meters you want to convert:"); meters=keyboard.nextDouble(); break; case 3: showFeet(meters); System.out.println("Please enter the number of meters you want to convert:"); meters=keyboard.nextDouble(); break; case 4: System.out.println(); break; default: System.out.println("Invalid selection."); System.out.println(); } } } public static double showKilometers(double meters) { double kilometers = 0.0; kilometers = meters * 0.001; System.out.println(meters+ " meters is " + kilometers + " kilometers."); return kilometers; } public static double showInches(double meters) { double inches = 0.0; inches=meters * 39.37; System.out.println(meters + " meters is " + inches + " inches."); return inches; } public static double showFeet(double meters) { double feet = 0.0; feet=meters * 3.281; System.out.println(meters + " meters is " + feet + " feet."); return feet; } }