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
What is the main advantage of Ram<br><br>​
andre [41]

Answer:

to get milk

Explanation:

gjvuvuvjvvjvjvvjvjvhvjvub

7 0
3 years ago
The keywords used in programming languages that use decisions to redirect the flow of a program are called __
olchik [2.2K]
The keywords used in programming languages that use decisions to redirect the flow of a program are called control structures.
6 0
3 years ago
Bob flys a drone which has a 20 megapixel camera attached, what is the definition of "megapixel in this context? Why does it mat
Verizon [17]

Answer:

megapixel refers to the unit of resolution i.e. one million

Explanation:

Interestingly the higher the pixels does not mean higher quality of image, it's more about the camera and it's sensor.

I am a photographer and a licensed drone pilot and have researched the subject to help with camera choice, both DSLR and drone.

5 0
2 years ago
Information that's been collected to help solve a problem is called
Butoxors [25]

Answer:

Data is the correct answer

5 0
2 years ago
Technological advancements during the industrial age provided Americans with:
Tems11 [23]

Technological advancements during the industrial age provided Americans with option B) More leisure times.

<h3>What were some technological advancements during the age of industry?</h3>

The growth in productivity is one that started with a little technical devices, such as the spinning jenny, spinning mule, and others.

Note that Technological advancements during the industrial age provided Americans with option B) More leisure times as machines does the work.

Learn more about Technological advancements from

brainly.com/question/2166344
#SPJ1

7 0
1 year ago
Other questions:
  • Barr the Bear has started a business to sell fish to Poe and his fellow penguins. The penguin customers submit many fish orders,
    12·1 answer
  • Mr. Perry has bookmarked a large number of webpages in Chrome while researching class topics. Unfortunately, he's bookmarked so
    13·1 answer
  • If you have two redo log groups with four members each, what’s the optimal number of disks you need to provide appropriate prote
    5·1 answer
  • What is the most important for you to choose before you build a network?
    7·1 answer
  • Rachel typed two paragraphs and then realized she was in the wrong document. What steps should Rachel follow to quickly move the
    15·2 answers
  • Create a game that rolls two dies (number from 1 to 6 on the side) sequentially for 10 times (use loop). If at least once out of
    14·1 answer
  • Please Help! <br> I need good Anime to watch!
    7·1 answer
  • In 5-10 sentences, describe the procedure for responding to an e-mail message.
    5·1 answer
  • CALLING ALL DEKUS UWU
    15·2 answers
  • Desktop computers have a(n) ________ unit, located within the system unit, that plugs into a standard wall outlet, converts AC t
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!