Hi ! so i have this assignment where i have to create a Wall paint calculator and I am having some difficulties coding it..
import java.util.Scanner;
class ProgramA{
public static void main(String [] args)
{
System.out.println("Welcome To Wall Paint Cost Calculator");
int length;
int width;
int height;
int cost;
Scanner keyboard = new Scanner (System.in);
System.out.println("Please enter below your room length in meters ");
length = keyboard.nextInt ();
System.out.println("Please enter below your room width in meters ");
width = keyboard.nextInt ();
System.out.println("Please enter below your room width in meters ");
height = keyboard.nextInt();
System.out.println("Your total area is:");
cost = length + width * height * 4 ;
System.out.println(cost);
}
}
The problem with this is code is that when i launch the program and type in my numbers for example lets say length is : 5 + width : 6 * height : 3 then * 4 I am always getting 77.
Please help thanks!
What I have tried:
import java.util.Scanner;
class ProgramA{
public static void main(String [] args)
{
System.out.println("Welcome To Wall Paint Cost Calculator");
int length;
int width;
int height;
int cost;
Scanner keyboard = new Scanner (System.in);
System.out.println("Please enter below your room length in meters ");
length = keyboard.nextInt ();
System.out.println("Please enter below your room width in meters ");
width = keyboard.nextInt ();
System.out.println("Please enter below your room width in meters ");
height = keyboard.nextInt();
System.out.println("Your total area is:");
cost = length + width ;
System.out.println(cost);
}
}