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
Assume that cell F5 to F10 In a spreadsheet contains numeric value of salary earned by some workers and cell F12 contains the va
snow_tiger [21]

Answer:

=F5*$F$12+F5

Explanation:

If we want to increment the salaries in the cell F5, we must multiply the cell F5 by cell F12, and then we must sum that result.

If we want to drag the formula from the cell F5 to F10, we must use the dollar symbol $ to apply the same percent in our formula.

For example:

F12 = 5% = 0.05

F5 = 10,000

=F5*$F$12+F5

=10,000×0.05+10,000 = 10,500

5 0
3 years ago
P16 Consider the following network. ISP B provides national backbone service to regional ISP A. ISP C provides national backbone
Art [367]

Solution :

Considering the following data :

$\text{ISP B}$ provides the national backbone to the regional $\text{ISP A}$.

$\text{ISP C}$ provides the national backbone to the regional $\text{ISP D}$.

Each of the ISP consists of one autonomous systems (AS).

$\text{ISP B}$ would like to hand over the traffic of C through the $\text{West}$ Coast.

The $\text{ISP C}$ would like to receive traffic from B's peering point via East Coast.

One way for $C$ to force $B$ to hand over all of $B$’s traffic to $D$ on the east coast is for $C$ to  only advertise its route to $D$ via its east coast peering point with $C$.

7 0
2 years ago
What are 3 examples of Chassis Wiring?
Roman55 [17]

Answer:

.

Explanation:

5 0
3 years ago
What is the definition of physical fitness?
Bond [772]
The answer is A:the body’s ability to be efficient during movement.
5 0
3 years ago
Read 2 more answers
For a Know Simple query, a Fully Meets rating can be given if the result does not display the answer, but it is at the very top
tekilochka [14]

Answer:

For a Know Simple query, a Fully Meets rating can be given if the result does not display the answer, but it is at the very top of the landing page.

B) False

Explanation:

  • A know simple query is special form of a know query. The query which are intended to know something like what is the length of pitch of a cricket ground?
  • A know simple query is such a know query that can be described in very little amount of words.
  • A know simple query would only get the fully meet ratings if the result shown has the result in a special result block or it is shown upfront. You don't need to open a link to get the answer in such scenario.

6 0
3 years ago
Other questions:
  • Create a text file that contains your expenses for last month in the following categories: • Rent • Gas • Food • Clothing • Car
    13·1 answer
  • Given an object context for an Entity Data Model named mmaBooks, which of the following statements would you use to add a Custom
    15·1 answer
  • What language used orthogonality as a primary design criterion?
    8·1 answer
  • What are the two main things an operating system does?
    14·1 answer
  • What are some of the causes for error 1921 when updating?
    11·2 answers
  • Do you need internet to play xbox one
    14·1 answer
  • Please help. will give u brainliest!! khan academy computers and the internet!!
    12·1 answer
  • In order to enhance the training experience and emphasize the core security goals and mission, it is recommended that the execut
    5·1 answer
  • I need help!!!! 1.04
    9·1 answer
  • If you are referencing cell (C2)in Excel and want to be able to copy the formula and keep using the data in cell C2 in every pla
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!