PSEUDOCODE, FLOWCHART AND CODE REPRESENTATION OF APPROXIMATE ESTIMATE OF THE NUMBER OF TILES REQUIRED TO FINISH FLOOR SPACES

 As a civil engineer, you are frequently required to provide approximate estimate of the number of tiles required to finish floor spaces. Write a simple program to help you complete this task as quickly as possible.

a.       Pseudocode
b.      Flowchart
c.       Code implementation (test with different values)



PSEUDOCODE


START

    // Step 1: Declare variables
    Declare floorLength, floorWidth, tileLength, tileWidth as real
    Declare floorArea, tileArea, numTiles as real

    // Step 2: Input floor dimensions
    PRINT "Enter floor length (in meters):"
    READ floorLength
    PRINT "Enter floor width (in meters):"
    READ floorWidth

    // Step 3: Input tile dimensions
    PRINT "Enter tile length (in meters):"
    READ tileLength
    PRINT "Enter tile width (in meters):"
    READ tileWidth

    // Step 4: Calculate the area of the floor
    floorArea = floorLength * floorWidth

    // Step 5: Calculate the area of one tile
    tileArea = tileLength * tileWidth

    // Step 6: Calculate the number of tiles required
    numTiles = floorArea / tileArea

    // Step 7: Round up the number of tiles to the next whole number
    numTiles = CEILING(numTiles)

    // Step 8: Output the result
    PRINT "Number of tiles required: " + numTiles

END

FLOWCHART



CODE
import java.util.Scanner;
public class Bundu {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        //GET FLOOR DIMENSION
        System.out.println("Enter floor length(in meter):");
        double floorLength = sc.nextDouble();
        System.out.println("Enter floor width(in meter):");
        double floorWidth = sc.nextDouble();
        double floorArea = floorLength * floorWidth;

        //GET TILES DIMENSION
        System.out.println("Enter tiles length(in meter):");
        double tilesLength = sc.nextDouble();
        System.out.println("Enter tiles width(in meter): ");
        double tilesWidth = sc.nextDouble();
        double tilesArea = tilesLength * tilesWidth;

        //CACULATE AND DISPLAY THE NUMBER OF TILES NEEDED
        int tilesNeeded =(int) Math.ceil (floorArea/tilesArea);
        System.out.println("we will need approximately " + tilesNeeded + " tiles for the floor");


    }
}

Comments

Popular posts from this blog

SOFTWARE DEVELOPMENT PARADIGMS

MILESTONES OF COMPUTING AND PROGRAMMING LANGUAGE