import java.util.*;
public class Main
{
public static void main(String[] args) {
System.out.print("Enter height of room: ");
double roomHeight = new Scanner(System.in).nextDouble();
System.out.print("Enter width of room: ");
double roomWidth = new Scanner(System.in).nextDouble();
System.out.print("Enter length of room: ");
double roomLength = new Scanner(System.in).nextDouble();
System.out.print("Enter width of door: ");
double doorWidth = new Scanner(System.in).nextDouble();
System.out.print("Enter height of door: ");
double doorHeight = new Scanner(System.in).nextDouble();
System.out.print("Enter width of first window: ");
double firstWindowWidth = new Scanner(System.in).nextDouble();
System.out.print("Enter height of first window: ");
double firstWindowHeight = new Scanner(System.in).nextDouble();
System.out.print("Enter width of second window: ");
double secondWindowWidth = new Scanner(System.in).nextDouble();
System.out.print("Enter height of second window: ");
double secondWindowHeight = new Scanner(System.in).nextDouble();
System.out.print("Enter the cost, per square foot, of painting the walls: ");
double wallsPaintingCost = new Scanner(System.in).nextDouble();
System.out.print("Enter the cost, per square foot, of installing carpet: ");
double installingCarpetCost = new Scanner(System.in).nextDouble();
double totalWallsPaintingCost = 0;
totalWallsPaintingCost += (2*roomLength*roomWidth + 2*roomLength*roomHeight + 2*roomWidth*roomWidth -
(firstWindowHeight*firstWindowWidth) - (secondWindowHeight*secondWindowWidth)
- (doorHeight*doorWidth))
*wallsPaintingCost;
double totalCarpetInstallationCost = installingCarpetCost*roomLength*roomWidth;
System.out.print(String.format("\n\nWalls painting cost: %.2f",totalWallsPaintingCost));
System.out.print(String.format("\n\nCarpet installation cost: %.2f",totalCarpetInstallationCost));
}
}
Comments
Leave a comment