A handyman company has decided to specialize in two tasks: painting and carpeting rooms. Write a Java application to determine the cost of a room to be painted or carpeted. One gallon of paint and eight hours of labor are required for every 12.7 square yards of space that needs to be painted. One hour of labor is required for every five square yards of carpet to be laid. The charge for labor is $18.00 per hour
1
Expert's answer
2014-09-24T12:05:09-0400
import java.util.Scanner; public class Main { /** * Main method * @param args */ public static void main(String[] args) { //Scanner for keyboard Scanner scanner =new Scanner(System.in); //variable for square painted double squarePainted; //variable for square carpeted double squareCarpeted; //variable for cost painted double costPainted=0; //variable for cost carpeted double costCarpeted=0; //prompt user to enter square yards of space that needs to be painted System.out.print("Enter square yards of space that needs to be painted: "); squarePainted=scanner.nextDouble(); //prompt user to enter square yards of space that needs to be carpeted System.out.print("Enter square yards of space that needs to be carpeted: "); squareCarpeted=scanner.nextDouble();
//calculate the cost of a room to be painted costPainted=(squarePainted/12.7)*8*18; //calculate the cost of a room to be carpeted costCarpeted=(squareCarpeted/5)*18; //show result System.out.println("\nThe cost of a room to be painted: "+costPainted); System.out.println("The cost of a room to be carpeted: "+costCarpeted); } }
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
Finding a professional expert in "partial differential equations" in the advanced level is difficult.
You can find this expert in "Assignmentexpert.com" with confidence.
Exceptional experts! I appreciate your help. God bless you!
Comments
Leave a comment