Having a little trouble with this one! Painting a wall import java.util.Scanner;
ID: 3926432 • Letter: H
Question
Having a little trouble with this one!
Painting a wall
import java.util.Scanner;
import java.lang.Math; // Note: Needed for math functions in part (3)
public class PaintEstimator {
public static void main(String[] args) {
Scanner scnr = new Scanner(System.in);
double wallHeight = 0.0;
double wallWidth = 0.0;
double wallArea = 0.0;
System.out.println("Enter wall height (feet): ");
wallHeight = scnr.nextDouble();
System.out.println("Enter wall width (feet): ");
wallWidth = scnr.nextDouble();
wallArea = wallWidth * wallHeight;
Explanation / Answer
import java.util.Scanner;
import java.lang.Math; // Note: Needed for math functions in part (3)
public class PaintEstimator {
public static void main(String[] args) {
Scanner scnr = new Scanner(System.in);
double wallHeight = 0.0;
double wallWidth = 0.0;
double wallArea = 0.0;
System.out.print("Enter wall height (feet): ");
wallHeight = scnr.nextDouble();
System.out.print("Enter wall width (feet): ");
wallWidth = scnr.nextDouble();
wallArea = wallWidth * wallHeight;
double gallonsPaint = calculateGallonsPaint(wallArea);
int noOfCans = cansNeeded(gallonsPaint);
System.out.println("Wall area: " + wallArea + " square feet");
System.out.println("Paint needed: " + gallonsPaint + " gallons");
System.out.println("Cans needed: " + noOfCans + " can(s)");
}
/**
* provide formula for calculate
*
* @param surfaceArea
* @return
*/
public static double calculateGallonsPaint(double surfaceArea) {
return 0;
}
/**
* provide formula for calculate
*
* @param gallonsPaint
* @return
*/
public static int cansNeeded(double gallonsPaint) {
return 0;
}
}
OUTPUT:
Enter wall height (feet): 12
Enter wall width (feet): 15
Wall area: 180.0 square feet
Paint needed: 0.0 gallons
Cans needed: 0 can(s)
NOTE: please comment formulas or logic to calculate above things
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.