I'm pretty new to java but i'm writing a program that will do some basic unit conversions. Here is what I have so far:
class Assignment8
{
public static void main(String[]args)
{
System.out.println( "1. US Measurment to Metric" + "\n" + "2. Metric to US Measurement" );
int us_or_metric = Input.getInt ( "Please enter the desired convertion" );
switch ( us_or_metric )
{
case 1:
System.out.println( "\n" + "1. Pound to Kilogram" + "\n" + "2. Ounce to Gram" + "\n" + "3. Foot to Meter" + "\n" + "4. Mile to Kilometer" );
int us_conversions = Input.getInt( "Please enter the desired convertion" );
switch ( us_conversions )
{
case 1:
double a = Input.getDouble( "Please enter amount to be converted" );
double b = 0.4536D;
System.out.println( a + "pound(s) is" + pound( a,b ) + "kilogram(s)" );
break;
case 2:
double c = Input.getDouble ( "Please enter amount to be converted" );
double d = 28.5D;
System.out.println( c + "ounce(s) is" + ounce( c,d ) + "gram(s)" );
break;
case 3:
double e = Input.getDouble ( "Please enter amount to be converted" );
double f = 0.3048D;
System.out.println( e + "feet is" + foot( e,f ) + "meter(s)" );
break;
case 4:
double g = Input.getDouble ( "Please enter amount to be converted" );
double h = 1.61D;
System.out.println( g + "mile(s) is" + mile( g,h ) + "kilometer(s)" );
break;
}
break;
case 2:
System.out.println( "\n" + "1. Kilogram to Pound" + "\n" + "2. Gram to Ounce" + "\n" + "3. Meter to Foot" + "\n" + "4. Kilometer to Mile" );
int metric_conversions = Input.getInt ( "Please enter the desired convertion" );
switch ( us_conversions )
{
case 1:
double i = Input.getDouble( "Please enter amount to be converted" );
double j = 2.2046D;
System.out.println( i + "kilogram(s) is" + kilogram( i,j ) + "pound(s)" );
break;
case 2:
double k = Input.getDouble ( "Please enter amount to be converted" );
double l = 0.0352D;
System.out.println( k + "gram(s) is" + gram( k,l ) + "ounce(s)" );
break;
case 3:
double m = Input.getDouble ( "Please enter amount to be converted" );
double n = 3.2808D;
System.out.println( m + "meter(s) is" + meter( m,n ) + "feet" );
break;
case 4:
double o = Input.getDouble ( "Please enter amount to be converted" );
double p = 0.6213D;
System.out.println( o + "kilometer(s) is" + kilometer( o,p ) + "mile(s)" );
break;
}
break;
}
}
public static double pound( double a , double b )
{
return a * b;
}
public static double ounce( double c , double d )
{
return c * d;
}
public static double foot( double e, double f )
{
return e * f;
}
public static double mile( double g , double h )
{
return g * h;
}
public static double kilogram( double i , double j )
{
return i * j;
}
public static double gram( double k , double l )
{
return k * l;
}
public static double meter( double m , double n )
{
return m * n;
}
public static double kilometer( double o , double p )
{
return o * p;
}
}
When I go to compile it I get the cannot find symbol error. I've looked at this page here What does a "Cannot find symbol" compilation error mean? but I can't identify my problem. Can someone help me find the error? Sorry if it is something obvious but I am still a coding noob. Ive gotten the program to compile and run but only in a specific location, a folder labeled java on my desktop. Any ideas on why this would happen?
Compilation error time: 0 memory: 0 signal:0
Main.java:13: error: cannot find symbol
int us_or_metric = Input.getInt ( "Please enter the desired convertion" );
^
symbol: variable Input
location: class Assignment8
Main.java:18: error: cannot find symbol
int us_conversions = Input.getInt( "Please enter the desired convertion" );
^
symbol: variable Input
location: class Assignment8
Main.java:22: error: cannot find symbol
double a = Input.getDouble( "Please enter amount to be converted" );
^
symbol: variable Input
location: class Assignment8
Main.java:27: error: cannot find symbol
double c = Input.getDouble ( "Please enter amount to be converted" );
^
symbol: variable Input
location: class Assignment8
Main.java:32: error: cannot find symbol
double e = Input.getDouble ( "Please enter amount to be converted" );
^
symbol: variable Input
location: class Assignment8
Main.java:37: error: cannot find symbol
double g = Input.getDouble ( "Please enter amount to be converted" );
^
symbol: variable Input
location: class Assignment8
Main.java:45: error: cannot find symbol
int metric_conversions = Input.getInt ( "Please enter the desired convertion" );
^
symbol: variable Input
location: class Assignment8
Main.java:49: error: cannot find symbol
double i = Input.getDouble( "Please enter amount to be converted" );
^
symbol: variable Input
location: class Assignment8
Main.java:54: error: cannot find symbol
double k = Input.getDouble ( "Please enter amount to be converted" );
^
symbol: variable Input
location: class Assignment8
Main.java:59: error: cannot find symbol
double m = Input.getDouble ( "Please enter amount to be converted" );
^
symbol: variable Input
location: class Assignment8
Main.java:64: error: cannot find symbol
double o = Input.getDouble ( "Please enter amount to be converted" );
^
symbol: variable Input
location: class Assignment8
11 errors