Java code This  exercise requires designing a program which solves the problem  described in the problem statement below. Provide comments as necessary  in your pseudo-code and the Java program. Your solution must include these components: A  painting company has determined that to paint 115 square feet of wall  space, the task will require one gallon of paint and 8 hours of labor.  The company charges $20.00 per hour for labor. Design a program  that asks the user to enter the number of square feet of wall space to  be painted and the price of paint per gallon. The program should then  calculate and display the following data: Your program should contain the following modules: Enter wall space in square feet: Enter price of paint per gallon: Gallons of paint: 4.3478260869565215 Hours of labor: 34.78260869565217 Paint charges: $112.99999999999999 Labor charges: $695.6521739130435 Total Cost: $808.6521739130435 You  must submit your solution as a Microsoft Word document (.docx) with all  components included in the one document. Also, submit the Java source  code file (.java).

Solution for Java Program to Calculate Cost of Painting

Problem statement:
A painting company has determined that to paint 115 square feet of wall space, the task will require one gallon of paint and 8 hours of labor. The company charges $20.00 per hour for labor. Design a program that asks the user to enter the number of square feet of wall space to be painted and the price of paint per gallon. The program should then calculate and display the following data:

– Gallons of paint required
– Hours of labor required
– Cost of paint
– Cost of labor
– Total cost

Algorithm:
1. Start the program.
2. Prompt the user to enter the number of square feet of wall space to be painted.
3. Read the input and store it in a variable called “wallSpace”.
4. Prompt the user to enter the price of paint per gallon.
5. Read the input and store it in a variable called “paintPrice”.
6. Calculate the gallons of paint required using the formula: gallons = wallSpace / 115
7. Calculate the hours of labor required using the formula: laborHours = wallSpace / 115 * 8
8. Calculate the cost of paint using the formula: paintCost = gallons * paintPrice
9. Calculate the cost of labor using the formula: laborCost = laborHours * 20
10. Calculate the total cost using the formula: totalCost = paintCost + laborCost
11. Display the calculated data: gallons, laborHours, paintCost, laborCost, totalCost.
12. End the program.

Pseudo-code:
“`
1. Start program
2. Prompt user to enter wall space
3. Read user input and store in variable wallSpace
4. Prompt user to enter paint price per gallon
5. Read user input and store in variable paintPrice
6. Set gallons = wallSpace / 115
7. Set laborHours = wallSpace / 115 * 8
8. Set paintCost = gallons * paintPrice
9. Set laborCost = laborHours * 20
10. Set totalCost = paintCost + laborCost
11. Display gallons
12. Display laborHours
13. Display paintCost
14. Display laborCost
15. Display totalCost
16. End program
“`

Java code:
“`java
import java.util.Scanner;

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

System.out.print(“Enter wall space in square feet: “);
double wallSpace = input.nextDouble();

System.out.print(“Enter price of paint per gallon: “);
double paintPrice = input.nextDouble();

double gallons = wallSpace / 115;
double laborHours = wallSpace / 115 * 8;
double paintCost = gallons * paintPrice;
double laborCost = laborHours * 20;
double totalCost = paintCost + laborCost;

System.out.println(“Gallons of paint: ” + gallons);
System.out.println(“Hours of labor: ” + laborHours);
System.out.println(“Paint charges: $” + paintCost);
System.out.println(“Labor charges: $” + laborCost);
System.out.println(“Total Cost: $” + totalCost);
}
}
“`

Explanation:
– The program starts by prompting the user to enter the wall space in square feet and the price of paint per gallon.
– The input values are then used to calculate the gallons of paint required, hours of labor required, cost of paint, cost of labor, and total cost.
– Finally, the calculated data is displayed on the console.

Please note that the formula used to calculate gallons and labor hours assumes that 115 square feet of wall space requires 1 gallon of paint and 8 hours of labor. You can modify these values as per your requirements.

Need your ASSIGNMENT done? Use our paper writing service to score better and meet your deadline.


Click Here to Make an Order Click Here to Hire a Writer