Question: Overview For this assignment, you will write a simple program that calculates how much paint to purchase in order to paint an entire room. You

Overview

For this assignment, you will write a simple program that calculates how much paint to purchase in order to paint an entire room. You can begin by downloading the Paint.java file, which will contain some starter code for you. You need to write code under each of the comments that begin with ***** . An example of how the output would look might be: A room that is 25 feet long and 15 feet wide and 8 feet high has YYY square feet and requires XX.XXX gallons of paint. The values of YYY and XX.XXX will be calculated by the program and be replaced with actual values. The XX.XXX may or may not be significant out to three decimal places. It might have two, it might have five. Don't worry about it matching the XX.XXX format perfectly other than having spaces on either side of that output.

// Name : Your Name

// Class : Lab Section

// Colleagues : None

// Resources : None

// The purpose of this program is to determine amount of paint needed

public class Paint

{

public static void main(String[] args)

{

// declare variables

// ***** one gallon of paint covers 350 square feet and this value

DOES NOT CHANGE

// ***** declare integers length, width, and height;

// ***** declare double totalSqFt;

// ***** declare double paintNeeded;

// ***** fill in values for the room's dimensions

// ***** Compute the total square feet to be painted--think

//about the dimensions of each wall

// ***** Compute the amount of paint needed

// ***** Print the length, width, and height of the room and the

/umber of gallons of paint needed.

// A room that is 25 feet long and 15 feet wide and 8 feet

high has YYY square feet and requires XX.XXX gallons of paint.

}

Expert Answer

Overview For this assignment, you will write a simple program that calculatesAnonymous answered this

Was this answer helpful?

// Name : Your Name

// Class : Lab Section

// Colleagues : None

// Resources : None

// The purpose of this program is to determine amount of paint needed

public class Paint

{

public static void main(String[] args)

{

// declare variables

// ***** one gallon of paint covers 350 square feet and this value

// ***** declare integers length, width, and height;

int length, width, height;

// ***** declare double totalSqFt;

double totalSqFt;

// ***** declare double paintNeeded;

double paintNeeded;

// ***** fill in values for the room's dimensions

length = 25;

width = 15;

height = 8;

// ***** Compute the total square feet to be painted--think

// room is cuboid shaped

// Area of cuboid = 2( lb + bh + hl )

totalSqFt = 2. * (double)( length * width + width * height + length * height );

//about the dimensions of each wall

// ***** Compute the amount of paint needed

paintNeeded = ( (double)totalSqFt / 350.0 );

// ***** Print the length, width, and height of the room and the

System.out.print(" room that is " + length + " feet long and " + width + " feet wide and " + height + " feet high has " + totalSqFt + " square feet ");

/umber of gallons of paint needed.

System.out.printf("and requires %.3f gallons of paint" , paintNeeded);

// A room that is 25 feet long and 15 feet wide and 8 feet

}

}

In this answer, the code does not follow all initial conditions requested in the assignment.

The following hint(s) may help you locate some ways in which your solution may be improved:

You are not printing the width of the room (15)

You are not printing the height of the room (8)

Your calculation for square footage is not correct

Sample Output

how much paint to purchase in order to paint an entire room.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!