Question
In Java Get Inputs: Set up a scanner object to get input for a square feet of a paint job and the cost of a
In Java
Get Inputs:
Set up a scanner object to get input for a square feet of a paint job and the cost of a gallon of paint. The values should be a double to allow for fractions. Also, have a nice header for the program. ***Happy Accidents Paint Company Job Calculator***
Calculate Values:
Paint:
Every 235 square feet we need 1 gallon of paint and 6 hours of labor. Taking the square feet we can divide by 235 and get how many gallons and how many hours of labor we need. There are some problems with this. Most stores while I can buy half gallons or even smaller quantities, it isn't really a good idea to buy the exact amount but rather more. So we are going to round our values. We will always have to round up using the Math.ceil() method.
Labor Hours:
We are doing the same calculator for the square feet divided by 235 but that tells us how many 6 hour labors we need. Example 362 I would divide by 235, get 1.5405xxxx and multiply that by six(6) to get 9.2455xxx. For labor we want the exact amount but only 2 decimal places. Use Math.round() method.
Labor Charge:
It is $38.50 per labor hour. Take total labor hours and multiply by $38.50 and round again to 2 decimal places.
Cost of Paint:
We know how many gallons of paint we need so take the inputted cost of paint and multiply by calculated cost of paint. Most likely won't need to be rounded by just in case you can use Math.round() here as well.
Total Charge:
We have everything calculated you would have a total value and the total cost of paint and labor charge so we know what to charge the customer. Note: this is more of a subtotal because we haven't done the tax yet.
Sales Tax:
They charge a 7% sales tax that needs to be added to each estimate. Set up a constant for the sales tax to the value of 0.07. Take that value and calculate the sales tax by multiplying the total by the sales tax variable. Round here again. (This constant should be outside of the loop)
Display Results and Loop:
For this you should also incorporate a currency NumberFormat object to use for printing out the values. Use any form of printing you would like. Once the results are printed you ask if they want to calculate another estimate and incorporate a while loop to loop the entire program.
Example Output(User Input bolded):
** Happy Accidents Paint Company Job Calculator ** Enter in square feet: 362 Enter cost of paint: 42.85 Gallons of Paint: 2 Labor Hours: 9.24 Cost of Paint: $85.70 Cost of Labor: $355.74 Subtotal: $441.44 Tax 7\%: $30.90 Total: $472.34 Calculate another (y) ? y ** Happy Accidents Paint Company Job Calculator ** Enter in square feet: 1245 Enter cost of paint: 36.72 Gallons of Paint: 6 Labor Hours: 31.79 Cost of Paint: $220.32 Cost of Labor: $1223.92 Subtotal: $1444.24 Tax 7\%: $101.10 Total: $1545.34 Calculate another (y)?n
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started