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
Discuss what repetitions structures are, and how they differ from the vectorization approaches we have previously studied in the
gogolik [260]

Repetition structures, or loops, are used when a program needs to repeatedly process one or more instructions until some condition is met, at which time the loop ends. Many programming tasks are repetitive, having little variation from one item to the next. Vectorized mathematical code appears more like the mathematical expressions found in textbooks, making the code easier to understand. That is the difference. Hope I could help you on Brainly.com!

6 0
3 years ago
ASAP HELP NO GUESS A new pet store wants to design a logo to be displayed on business cards, posters in the shop’s windows, and
murzikaleks [220]

[2] JPG graphic  i hope this helps

6 0
3 years ago
Read 2 more answers
According to your textbook, which of the following is a consequence of the quick development of new technologies in the digital
kramer

Answer:

E. Traditional leaders in communication have lost some control over information                                                              

Explanation:

Due to the quick development of new technologies like Internet, cable etc, traditional leaders in communication have lost some of their control over information. This means that the technological advancement is disruptive for traditional leaders. Following examples are given to elaborate the consequences of advancement in new technology in digital era.

With the establishment of new channels like CNN, Fox News and internet bloggers, the old television network news shows like ABC, NBC lost their audiences.

Email technology has taken on some of the postal service's responsibilities and outperforms attempts to control communication outside national borders. This replaced the postal mail which used to take months to reach the destination.

The Internet and social media websites are transforming the way in which we access and interact with media culture. Before internet most people would watch popular TV shows in  at the time they originally aired it. This  scheduling gave common media interactions at specific times within our society. We still watch these TV shows but now we watch them at our own ease through websites. Using You tube we can upload our own media instead of viewing mainstream television.

8 0
3 years ago
Define a function print_feet_inch_short(), with parameters num_feet and num_inches, that prints using ' and " shorthand. End wit
Crazy boy [7]

def print_feet_inch_short(num_feet, num_inches):

#function named print_feet_inch_short takes in two arguments.

print(str(num_feet)+"'",str(num_inches)+"\"")

#output the feet and inch value supplied with the shorthand sign of feet and inch using string concatenation.

num_feet = int(input())

#allows user to specify a feet value and stores it in num_feet

num_inches = int(input())

#allows user to specify an inch value and stores it in num_inch

print_feet_inch_short(num_feet, num_inches)

#calling the function with the number of feets and inches given by user.

Learn more : brainly.com/question/18318709

4 0
2 years ago
Read 2 more answers
Take the MBTI test and research information about this tool. Several websites have different versions of the test, including www
slega [8]

Answer:

why

Explanation:

3 0
3 years ago
Other questions:
  • Your new home has a vacuum system. what kind of computer is controlling it?
    5·1 answer
  • Which of the following branches of government is NOT involved in Discretionary Fiscal Policy?
    8·1 answer
  • What will be the value of ans after the following code has been executed?
    10·2 answers
  • write a program that calculates the total grade for N classroom exerices as a perfentage. the user should input the value for N
    11·1 answer
  • Create a program that finds (n+1)! -factorial- of an integer n in C++.
    13·1 answer
  • Please help ASAP! will mark brianliest! 30 points!
    14·1 answer
  • 2. How much did John Jones have in his account on the first day of the
    5·1 answer
  • What’s cloud-based LinkedIn automation?
    14·1 answer
  • Explain why you would use the soft on/off jumper when working on ATX system
    14·1 answer
  • 1.1 give five (5) reasons why modeling is an important part of system analysis and design
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!