Originally Posted by
unleashed-my-freedom
I had tried this coding myself but I had a different answer from the solution given. May I know if it is the same?
//calculate the mass
long massOfTheBlock = length * width * height * density
System.out.println("Length of the block, in cm is " + length);
System.out.println("Width of the block, in cm is " + width);
System.out.println("Height of the block, in cm is " + height);
System.out.println("The mass of the block is" + massOfTheBlock "grams")
AND
System.out.println("Height of the block, in cm is " + height);
System.out.println("");
// Calculate and print the block's mass.
System.out.println("The mass of the block is "
+ (length * width * height * AL_DENSITY) + " grams");
If
AL_DENSITY is equal to
density then it's the same between
System.out.println("The mass of the block is" + massOfTheBlock + "grams")
and
System.out.println("The mass of the block is " + (length * width * height * AL_DENSITY) +" grams");