1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
sineoko [7]
3 years ago
5

Assume that a gallon of paint covers about 350 square feet of wall space. Create anapplication with a main() method that prompts

the user for the length, width, andheight of a rectangular room. Pass these three values to a method that does the following:-a. Calculates the wall area of a roomb. Passes the calculated wall area to another method that calculates and returns thenumber of gallons of paint needed.c. Displays the number of gallons needed.d. Computes the price based on a paint price of $32 per gallon, assuming that the paintercan buy any fraction of a gallon of paint at the same price as a whole gallon.e. 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;
}

}
Computers and Technology
1 answer:
Elena-2011 [213]3 years ago
3 0

Answer:

import java.util.Scanner;

public class PaintClculator {

   public static void main(String[] args) {

Scanner in = new Scanner(System.in);

       System.out.println("Enter Values for length, width, and height of the room");

       double length = in.nextDouble();

       double width = in.nextDouble();

       double height = in.nextDouble();

       double wallArea = calculateWallArea(length,width,height);

       double noGallons = calculatePaint(wallArea);

       double price = price(noGallons);

       System.out.println("Price is: "+ price);

   }

   // Creating Method to Calculate Wall Area

   public static double calculateWallArea( double length, double width, double height){

       // formular for the surface area of a room Area=2*length*heigth+2*width*height+lenth*width

       double Area = 2*length*height+2*width*height+length*width;

       System.out.println("Wall Area: "+Area);

       return Area;

   }

   //Creating method to calculate amount of paint

   public static double calculatePaint(double Area){

       double noGallons = Area/350;

       System.out.println("Number of gallons: "+noGallons);

       return noGallons;

   }

   // Creating Method Calculate Price

   public static double price(double noGallons){

       return noGallons*32;

   }

}

Explanation

  1. Created Three Methods in all; calculateWallArea(), calculatePaint(), and price()
  2. Method calculateWallArea() calculates area based on this formula Area=2*length*heigth+2*width*height+lenth*width
  3. The value of Area is passed to method calculatePaint() Which calculates the number of gallons required to cover the area given that one gallon covers 350 wall space
  4. Method price() calculates and dis[plays the price by calling method calculatePaint() that returns number of gallons. since one gallon is 32$
You might be interested in
Fill in the blank with the correct response.
harina [27]

Answer:

program

Explanation:

6 0
2 years ago
A developer of a relational database refers to a file as a
goldenfox [79]
This is the correct Answer    <span>Attribute</span>
5 0
2 years ago
Match the following:
Bogdan [553]

Answer:

  1. Operating System.
  2. Laptop.
  3. Convertible computer.
  4. Peripheral.
  5. Desktop Computer.

Explanation:

Operating system is a software that manages the hardware and the software in the system and provides the interface between machine and the user.

Laptops are the portable computing devices which you can carry with you.

Convertible computer have a keyboard that is detachable and can be converted into a tablet.

Peripherals are devices which we can attach to the computer.

Desktop computer is a computing device that not portable at all.

3 0
2 years ago
Is a display, or monitor, considered a piece of computer hardware
9966 [12]
Yes. The monitor is considered as a piece of Computer Hardware. Computer hardware is what you can physically touch, like the keyboard, mouse, monitor, disk drive, and so on.

I hope this answers your question.

Thank you,
Otaku
3 0
2 years ago
Which of the following is FALSE? Select one: a. The fast-paced and collaboration-based business environment makes email less use
12345 [234]

Answer:

The Atos case demonstrates that it is possible to cut out e-mail entirely.

Explanation:

6 0
3 years ago
Other questions:
  • For your biology class, you have taken a number of measurements for a plant growth experiment. You wish to create a chart that s
    7·2 answers
  • Is using abbreviations and symbols in social media a problem? Why or why not?
    11·1 answer
  • Computer user support helps people with minor computer problems. <br><br> True or False
    12·1 answer
  • Someone who is young, lacks funds, and really wants to gain technical skills while serving his or her nation should consider
    8·1 answer
  • Int a=10 int b=20<br> A=b<br> The new values for a and b are
    11·2 answers
  • What is application software used for
    13·1 answer
  • A rocket always rotates about its___?
    9·2 answers
  • What might happen if dispatchable threads were removed from the software hierarchy? A. Requests from the mouse would be ignored.
    9·1 answer
  • If a citation has a volume, title, and page numbers, it is a:
    9·2 answers
  • Why is the computer uses binary why not trinary?​
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!