Answer to Question #319828 in Java | JSP | JSF for hussain

Question #319828

Task 1:




Building contractor




You are developer and you wish to build five new houses, all from wood and all uniform.




Each house has 3 rooms, all with exactly the same dimensions, i.e. 2m x 4m. Wood prices




have been set at £6.00 per meter.




You need to determine the total cost of the build of all five houses. Initially, you will need




to write the pseudocode to solve the following problem, define the variable name and data




types, plus write the code to solve the total build cost.




Hint: Determine the area of each room in each house and the total area of all rooms




combined. Thus, giving the total price of the construction. in java





1
Expert's answer
2022-03-28T14:28:55-0400
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);

        int house = 5;
        int room = 3;
        int len = 2;
        int we = 4;
        double cost = 6;

        int areaRoom = len * we;
        int totalArea = areaRoom * room * house;

        double totalCost = totalArea * cost;

        System.out.println("Room area: " + areaRoom);
        System.out.println("Area of all rooms: " + totalArea);
        System.out.println("Total price of the construction: " + totalCost);
    }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS