subject

Assume that a gallon of paint covers about 350 square feet of wall space. Create an application with a main() method that prompts the user for the length, width, and
height of a rectangular room. Pass these three values to a method that does the following:
- Calculates the wall area of a room
- Passes the calculated wall area to another method that calculates and returns the
number of gallons of paint needed.
- Displays the number of gallons needed.
- Computes the price based on a paint price of $32 per gallon, assuming that the painter
can buy any fraction of a gallon of paint at the same price as a whole gallon.
- Returns the price to the main() method
The main() method displays the final price. For example, the cost to paint a 15-by-20-foot
room with 10-foot cielings is $64 dollars. Save as PaintClculator. java
**Note: I can prompt the user, but I can't get a return from my code.
import java. util. Scanner;
public class PaintCalculator {
public static void main(String [] args)
{
Scanner keyboard = new Scanner(System. in);
double wallArea;
double height;
double length;
double width;
double price;
double WallArea;
double paintQuantity;
//Prompts user for the dimensions of the room
System. out. print("Please enter the height of the room: ");
height = keyboard. nextDouble();
System. out. print("Please enter the length of the room: ");
length = keyboard. nextDouble();
System. out. print("Please enter the width of the room: ");
width = keyboard. nextDouble();
WallAreaMethod(height, length, width);
}
//Calulates the area of the wall in a room
public static double WallAreaMethod(double height, double length, double width)
{
double wallArea;
wallArea = length * height * width * height;
return wallArea;
}
//Computes the quanity of paint needed
public static double paintFormula(double wallAreaMethod, double price, double height, double length, double width)
{
double wallArea;
double paintQuantity;
paintQuantity = wallAreaMethod * 2 / 350;
System. out. println("For a room of height " + height + "feet, length " +
length + " feet, and width " + width + " feet you need to purchase "
+ paintQuantity + " gallons of paint.");
System. out. println("The price will be $" + price + ".");
price = paintQuantity * 32.0;
return price;
}
}

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 06:50
Match the personality traits with their description
Answers: 1
question
Computers and Technology, 22.06.2019 21:00
Simon says is a memory game where "simon" outputs a sequence of 10 characters (r, g, b, y) and the user must repeat the sequence. create a for loop that compares the two strings starting from index 0. for each match, add one point to userscore. upon a mismatch, exit the loop using a break statement. assume simonpattern and userpattern are always the same length. ex: the following patterns yield a userscore of 4: simonpattern: rrgbryybgy userpattern: rrgbbrybgy
Answers: 2
question
Computers and Technology, 22.06.2019 21:30
How do you take a green screen out of the video while editing?
Answers: 2
question
Computers and Technology, 22.06.2019 22:00
Consider the following declarations (1, 2, 3, 5, 7)class bagtype{public: void set(string, double, double, double, double); void print() const; string getstyle() const; double getprice() const; void get(double, double, double, double); bagtype(); bagtype(string, double, double, double, double); private: string style: double l; double w; double h; double price; }; a.) write the definition of the number function set so that private members are set according to the parametersb.) write the definition of the member function print that prints the values of the data membersc.) write the definition of the default constructor of the class bagtype so that the private member variables are initialized to "", 0.0, 0.0, 0.0, 0.0, respectively d.) write a c++ statement that prints the value of the object newbag.e.) write a c++ statement that declares the object tempbag of type bagtype, and initialize the member variables of tempbag to "backpack", 15, 8, 20 and 49.99, respectively
Answers: 3
You know the right answer?
Assume that a gallon of paint covers about 350 square feet of wall space. Create an application wit...
Questions
question
Computers and Technology, 27.06.2020 15:01
Questions on the website: 13722359