I am new to Java and am currently taking a class where one of our assignments is to compute the mass of an aluminum block. We are currently on week 2 and only into our second chapter. I am completely lost! I have followed every example from the book I can find and I am getting errors all over the place. If anyone could help I would be extremely greatful! Thanks!
Here is what I have so far!
public class W3Ex33 {
//main(): application entry point
public static void main(String[] args) {
int density = 2.7;
int volume = length * Width * height;
int mass = density * volume;
int length
int width
int height
Scanner stdin = new Scanner(System. in); //set up input string
System.out.prin t("Length is: "); //read int length
double length = stdin.nextInt() ;
System.out.prin t("Width is: "); //read int width
double width = stdin.nextInt() ;
System.out.prin t("Height is: "); //read int height
doublt height = stdin.nextInt() ;
double volume = length * Width * height; //convert to metric equivalents
double mass = density * volume; //perform mass calculation
System.out.prin tln("An aluminum block with:"); //display results
System.out.prin tln(" length " + length);
System.out.prin tln(" width " + width);
System.out.prin tln(" height " + height);
System.out.prin tln("has a Mass of " + mass);
} //End method main
} // end class W3Ex33
Once again, if anyone can help! Thanks so much!
Here is what I have so far!
public class W3Ex33 {
//main(): application entry point
public static void main(String[] args) {
int density = 2.7;
int volume = length * Width * height;
int mass = density * volume;
int length
int width
int height
Scanner stdin = new Scanner(System. in); //set up input string
System.out.prin t("Length is: "); //read int length
double length = stdin.nextInt() ;
System.out.prin t("Width is: "); //read int width
double width = stdin.nextInt() ;
System.out.prin t("Height is: "); //read int height
doublt height = stdin.nextInt() ;
double volume = length * Width * height; //convert to metric equivalents
double mass = density * volume; //perform mass calculation
System.out.prin tln("An aluminum block with:"); //display results
System.out.prin tln(" length " + length);
System.out.prin tln(" width " + width);
System.out.prin tln(" height " + height);
System.out.prin tln("has a Mass of " + mass);
} //End method main
} // end class W3Ex33
Once again, if anyone can help! Thanks so much!
Comment