Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Main {
- private static final int WALL_SPACE_SQFT = 115;
- private static final int GALLONS_OF_PAINT = 1;
- private static final int HOURS_OF_LABOR = 8;
- private static final double CHARGES_PER_HOUR = 18.00;
- public static void main(String[] args)
- {
- Scanner scanner = new Scanner(System.in);
- System.out.println("Enter number of rooms");
- int rooms = scanner.nextInt();
- double [] roomWallSpaces = new double[rooms];
- System.out.println("Enter wall space SQF per room");
- for (int i = 0; i < roomWallSpaces.length; i++)
- {
- roomWallSpaces[i] = scanner.nextDouble();
- }
- System.out.println("Enter price per gallon of paint");
- double pricePerGallon = scanner.nextDouble();
- System.out.println("Number of gallons of paint required: " + getGallonsRequired(roomWallSpaces));
- System.out.println("Number of hours of labor required: " + getHoursOfLaborRequired(roomWallSpaces));
- System.out.println("The cost of paint required: " + getTotalCostOfPaint(roomWallSpaces, pricePerGallon));
- System.out.println("Total labor charges: " + getTotalLaborCharges(roomWallSpaces));
- System.out.println("Total cost of the paint job: " + getTotalCostOfPaint(roomWallSpaces, pricePerGallon));
- }
- public static double getOverallRoomWallSpaces(double[] roomWallSpaces)
- {
- double overallRoomWallSpaces = 0;
- for (double roomWallSpace : roomWallSpaces) {
- overallRoomWallSpaces += roomWallSpace;
- }
- return overallRoomWallSpaces;
- }
- public static double getGallonsRequired(double[] roomWallSpaces)
- {
- return getOverallRoomWallSpaces(roomWallSpaces) / WALL_SPACE_SQFT * GALLONS_OF_PAINT;
- }
- public static double getHoursOfLaborRequired(double[] roomWallSpaces)
- {
- return getOverallRoomWallSpaces(roomWallSpaces) / WALL_SPACE_SQFT * HOURS_OF_LABOR;
- }
- public static double getTotalCostOfPaint(double[] roomWallSpaces, double pricePerGallon)
- {
- return getGallonsRequired(roomWallSpaces) * pricePerGallon;
- }
- public static double getTotalLaborCharges(double[] roomWallSpaces)
- {
- return getHoursOfLaborRequired(roomWallSpaces) * HOURS_OF_LABOR;
- }
- public static double getTotalCharges(double[] roomWallSpaces, double pricePerGallon)
- {
- return getTotalCostOfPaint(roomWallSpaces, pricePerGallon) + getTotalLaborCharges(roomWallSpaces);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment