I need some help with a Measurement Program I Wrote.....I have this code as the main workings of my program:
.....when i compile i am getting 2 errors the errors i'm getting are:
Measurement.jav a:5: illegal start of expression
static Scanner console = new Scanner(System. in)
^
Measurement.jav a:13: illegal start of expression
public void printScreenFeet () throws InputMismatchEx ception {;
Does anyone know how to fix these errors? I've got no idea and I need some help BADLY!!! Please Help!!!
THANKS!!
The Supporting Classes i have are the Main2 class:
.......PLEASE HELP!! THANK YOU!!
Code:
import java.util.*;
public class Measurement{
{
static Scanner console = new Scanner(System.in)
public static void main(String[] args);
double feet, inches, feetTotal, inchTotal, centTotal;
boolean done;
String str;
ConvExc checkForZero = new ConvExc();
public void printScreenFeet() throws InputMismatchException {
done = false;
do{
try
{
System.out.println("Enter Feet Measurement:");
double feet;
System.out.flush();
feet = console.nextDouble();
while (checkForZero.enterZeroExc(feet)) {
System.out.println("Please Enter a Number Greater then Zero!");
System.out.println("Enter Feet Measurement:");
System.out.flush();
feet = console.nextDouble();
}
done = true;
}
catch (InputMismatchException imeRef){
str = console.next();
System.out.println("Error: Please enter a new number value");
System.out.println();
}
}while (!done);
}
public void printScreenInch() throws InputMismatchException {
done = false;
do{
try{
System.out.println("Enter Inches Measurement:");
double inches;
System.out.flush();
inches = console.nextDouble();
while (checkForZero.enterZeroExc(inches)) {
System.out.println("Please Enter a Number Greater then Zero!");
System.out.println("Enter Inches Measurement:");
System.out.flush();
inches = console.nextDouble();
}
done = true;
}
catch (InputMismatchException imeRef){
str = console.next();
System.out.println("Error: Please enter a new number value");
System.out.println();
}
}while (!done);
}
feetTotal = feet*30.48;
inchTotal = inches*2.54;
centTotal = feetTotal+inchTotal;
System.out.println(feetTotal + " cm in " + feet + " feet");
System.out.println(inchTotal + " cm in " + inches + " inches");
System.out.println("Total cm = "+centTotal);
}
}
.....when i compile i am getting 2 errors the errors i'm getting are:
Measurement.jav a:5: illegal start of expression
static Scanner console = new Scanner(System. in)
^
Measurement.jav a:13: illegal start of expression
public void printScreenFeet () throws InputMismatchEx ception {;
Does anyone know how to fix these errors? I've got no idea and I need some help BADLY!!! Please Help!!!
THANKS!!
The Supporting Classes i have are the Main2 class:
Code:
public class Main2 {
public static void main(String[] args) {
Conversion display = new Conversion();
display.printScreenFeet();
display.printScreenInch();
display.printConversion();
}
}
and the ConvExc Class:
import java.util.*;
public class ConvExc {
public boolean enterZeroExc(double num){
if (num<0) {
return true;
}
else {
return false;
}
}
.......PLEASE HELP!! THANK YOU!!
Comment