I need to create a java program to calculate the costs and time associated with
ID: 3547597 • Letter: I
Question
I need to create a java program to calculate the costs and time associated with painting only the walls in the room provide the length, width and height (in feet) of a room along with the total square footage of doors and windows that are not painted one gallon of paint will cover 150 square feet and takes 60 minutes to apply using whole gallons therefore any fractional amount calculated must be rounded up to the next whole gallon, i.e. a calculated 2.4 gallons would be rounded to 3. The company also charges $15.00 per hour for labor. Finally provide the cost per gallon for the paint he is using. The eventual program will display Number of gallons required Total cost of the paint Total time needed to paint the room and Total labor cost.
Test case: For a room 10 ft x 10 ft x 8 ft with 40 sq ft of window/door space.
Paint cost of $15/gal
Number of gallons required = 2
Total cost of the paint = $30.00
Total time needed to paint the room = 1 hour 52 min
Total labor cost = $28.00
Document the following areas: Determine the primary class(es) and hence the object(s) Determine the methods Define the interface Determine instance variables Implement the methods Create the final class Test and debug as necessary Remember
Explanation / Answer
import java.util.*;
import java.lang.*;
import java.io.*;
class paint
{
public static void main (String[] args) throws java.lang.Exception
{
double height,width,length,window_area;
height=10.0;
width=10.0;
length=8.0;
window_area=40.0;
double total_area=height*width+width*length+height*length+window_area;//calculatin/g total area
double gal=total_area/150.0;//finding required gal
double cost=gal*15.0;//finding cost
int gallon=Math.round(gal);//rounding the gallon
int time=gallon*60;//calculating time
int hr=time/60;//Hour
int min=time%60;//minute
double charge=hr*15.0;//labor cost
//Printing all the outputs
System.out.println("Height:"+height+"Width:"+width+"Length:"+length+"Window Area:"+window_area);
System.out.println("No. of Gallon Required:"+gallon);
System.out.println("Cost of Paint:"+cost);
System.out.println("Time:"+hr+"hr"+min+"min");
System.out.println("Labor Cost:"+charge);
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.