For this assignment, we will use java languege, methods with parameters and retu
ID: 638990 • Letter: F
Question
For this assignment, we will use java languege, methods with parameters and return values to decompose a complex problem into simpler parts. The object is to calculate the cost of a paint job A painting company has determined that for every 112 square feet of wall space, one gallon of paint and eight hours of labor will be required. The company charges $35.00 per hour for labor. Modify your program so that it prints all values of money as numbers with exactly 2 decimal places. To generate report values for money that have exactly two decimal places, use System.out.printf . Complete the program named PaintJobEstimator.java so that it will display the following data:
The number of gallons of paint required (This is an integer value. You can
Explanation / Answer
import java.io.*;
import java.util.*;
class main{
public static void main(String[] args){
double sf,price;
Scanner scan = new Scanner(System.in);
System.out.print("Enter the number of square feet: ");
sf = scan.nextDouble();
System.out.print("Enter the price of a gallon of paint: ");
price = scan.nextDouble();
System.out.println("To paint "+sf+" square feet, with paint that costs "+price+" per gallon,");
System.out.println("you will need "+sf/112.0 +" gallons of paint and "+8*(sf/112.0)+" hours of labor.");
System.out.println("The cost of the paint is: "+(sf/112.0)*price);
System.out.println("The cost of the labor is: "+8*(sf/112.0)*35+" The total cost of the job is: "+((8*(sf/112.0)*35)+(sf/112.0)*price));
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.