Calculatior
PSEUDOCODE
BEGIN
DISPLAY "Hello Daddy, what shape are you solving today"
READ shape
DISPLAY "What is the length of tile?"
READ tilewidth
DISPLAY "What is the width of tile?"
READ tilelength
DISPLAY "What is the length of the room?"
READ floorwidth
DISPLAY "What is the width of the room?"
READ floorlength
// Calculate tile area
SET tile = length1 * width1
// Calculate floor area
SET floor = length2 * width2
// Calculate total tiles needed
SET Total = floor / tile
DISPLAY “floor area” = “ + total + “ m2”
END
FLOWCHART
JAVA CODE
import java.util.Scanner;
public class Tilecalculator{
public static void main(String[] args) {
Scanner daddy = new Scanner(System.in);
System.out.println("Hello Daddy, what shape are you solving today");
daddy.next();
System.out.print("Please input the length of tile");
double tileLength = daddy.nextDouble();
System.out.print("Please input the widht of tile");
double tileWidth = daddy.nextDouble();
System.out.println("Please input the width of the floor");
double floorwidth = daddy.nextDouble();
System.out.println("Please enter the length of the floor");
double floorlength = daddy.nextDouble();
double tile = tileLength * tileWidth;
double floor = floorlength * floorwidth ;
double total = floor / tile;
System.out.println("Floor Area = " + total + " m²");
}
}


Comments
Post a Comment