Question

In: Computer Science

I know that there are several different answers that has already been posted for this. I...

I know that there are several different answers that has already been posted for this. I have tried all of the options but wanted to see if I can get a correct one that actually works.

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 for 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:

You will need 2.0 gallons
The price to paint the room is $64.0

Grading

Write your Java code in the area on the right. Use the Run button to compile and run the code. Clicking the Run Checks button will run pre-configured tests against your code to calculate a grade.

Once you are happy with your results, click the Submit button to record your score.

  • PaintCalculator.java

14

1

import java.util.Scanner;

2

public class PaintCalculator {

3

    public static void main (String args[]) {

4

        // Write your code here

5

    }

6

7

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

8

        // Write your code here

9

    }

10

    public static double computeGallons(double area) {

11

        // Write your code here

12

    }

13

}

14

​Please, please please help!  I've been working on this problem for a week now.

Solutions

Expert Solution

import java.util.Scanner;

public class PaintCalculator {
    public static void main(String args[]) {
        Scanner in = new Scanner(System.in);
        System.out.print("Enter length: ");
        double length = in.nextDouble();
        System.out.print("Enter width: ");
        double width = in.nextDouble();
        System.out.print("Enter height: ");
        double height = in.nextDouble();

        double area = computeArea(length, width, height);
        double gallons = computeGallons(area);
        System.out.println("You will need " + gallons + " gallons");
        System.out.println("The price to paint the room is $" + (32 * gallons));

        in.close();
    }

    public static double computeArea(double length, double width, double height) {
        return 2*(length*width + length*height + height*width);
    }

    public static double computeGallons(double area) {
        return Math.ceil(area / 350);
    }
}

Related Solutions

This question has already been posted, but the answers are not coming across on my MindTap...
This question has already been posted, but the answers are not coming across on my MindTap as correct. I'm hoping somebody can do it differently so that it is accecpted. Create a class named Person that holds the following fields: two String objects for the person’s first and last name and a LocalDate object for the person’s birthdate. Create a class named Couple that contains two Person objects. Create a class named Wedding for a wedding planner that includes the...
******I KNOW THIS QUESTION HAS ALREADY BEEN ANSWERED; HOWEVER I WOULD LIKE A DIFFERENT ANSWER***** With...
******I KNOW THIS QUESTION HAS ALREADY BEEN ANSWERED; HOWEVER I WOULD LIKE A DIFFERENT ANSWER***** With the aid of supply and demand diagrams, explain how each of the following would likely affect the prices and quantities of cigarettes sold in the US. (a) A cure is found for lung cancer. (b) There is a substantial increase in wages in tobacco growing states. (c) A fertilizer that increases the yield per acre of tobacco is discovered. (d) There is a substantial...
I HAVE POSTED THIS TWICE ALREADY AND GOT WRONG ANSWERS. PLS ANSWER ONLY IF SURE IN...
I HAVE POSTED THIS TWICE ALREADY AND GOT WRONG ANSWERS. PLS ANSWER ONLY IF SURE IN AN ELABORATE FORM. Proposition: "Entrepreneurship" is a meaningless phrase of no importance for economics. Support or attack this proposition
I posted this question looking for a new paper not an answer that's already posted on...
I posted this question looking for a new paper not an answer that's already posted on chegg since if someone already turned in that paper it will show as a copied paper... the question is.. write a paper of 300-600 words presenting your analysis of the following topic- Discuss shortages and surpluses and how they re-direct resources
Please post something that has not already been posted. Imagine that one of your colleagues has...
Please post something that has not already been posted. Imagine that one of your colleagues has offered you the opportunity to become a partner in a new business venture. The colleague stipulates that due to your past relationship, there is no reason to draw up a partnership agreement. From the information you’ve gathered from Form 1065, identify the different partnership roles and select the one with the least potential liability if the business fails. Discuss the pros and cons of...
I NEED AN ESSAY OF 1000 WORDS AT LEAST BECAUSE I ALREADY POSTED THIS QUESTOIN I...
I NEED AN ESSAY OF 1000 WORDS AT LEAST BECAUSE I ALREADY POSTED THIS QUESTOIN I GOT SHORT ANSWER .PLEASE HELP Using the human resource department for recruitment, training, development and retaining employees can give any organization a competitive advantage. Some organizations became very successful in their markets by establishing an employee centered culture. Discuss how HRM activities enable organizations to become more competitive in their markets. Use an example of a well known organization that had been successful. In...
using C , comments will be appreciated. I already posted this before and I am looking...
using C , comments will be appreciated. I already posted this before and I am looking for different answer. please answer both part of the question. A) Write down an function named bitwisedFloatCompare(float number1, float number2) that tests whether a floating point number number1is less than, equal to or greater than another floating point number number2, by simply comparing their floating point representations bitwise from left to right, stopping as soon as the first differingbit is encountered. The fact that...
Even though it's posted. Looking for different answers since the answers in that post are not...
Even though it's posted. Looking for different answers since the answers in that post are not correct discuss the following financial environment concept: If you were going to invest money, given the current financial market status, where would you invest your money today? What are some possible investment choices for you as an individual? What factors influence your decision on what to invest in? How does the economic climate affect what you invest in?
* I have already posted but they answered it incorrectly The contribution format income statement for...
* I have already posted but they answered it incorrectly The contribution format income statement for Huerra Company for last year is given below: Total Unit Sales $ 1,006,000 $ 50.30 Variable expenses 603,600 30.18 Contribution margin 402,400 20.12 Fixed expenses 322,400 16.12 Net operating income 80,000 4.00 Income taxes @ 40% 32,000 1.60 Net income $ 48,000 $ 2.40 The company had average operating assets of $507,000 during the year. Required: 1. Compute the company’s return on investment (ROI)...
This problem has already been half answered, but can someone finish it and check the answers....
This problem has already been half answered, but can someone finish it and check the answers. I'll include the link. Finished ASAP please! https://www.chegg.com/homework-help/questions-and-answers/use-weighted-average-costing-wanda-company-produces-finished-product-two-processing-depart-q29753062 USE WEIGHTED AVERAGE COSTING: Wanda Company produces its finished product in two processing departments--Mixing and Finishing. The following information is available for the month of March: Mixing Department: The beginning work-in-process inventory was $17,130 ($14,880 direct materials and $2,250 conversion costs) and consisted of 1,200 units. During March, an additional 10,600 units were started into production....
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT