* CENGAGE MINDTAP Q Search this course Programming Exercise 3-8 Instructions PaintCalculator.java >- Terminal 1 import java.util.Scanner; 2 public class PaintCalculator { public static void main (String args[]) { // Write your code here sandbox $ || Assume that a gallon of paint covers about 350 square feet of wall 3 space. Create an application with a main() method that prompts 4 the user for the length, width, and height of a rectangular room. </> Pass these three values to a method that does the following: public static double computeArea (double length, double width, double height) { // Write your code here } public static double computeGallons (double area) { // Write your code here 8 • Calculates the wall area for a room 9 • Passes the calculated wall area to another method that 10 11 calculates and returns the number of gallons of paint needed } 13 } 12 • 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

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter3: Using Methods, Classes, And Objects
Section: Chapter Questions
Problem 2GZ
icon
Related questions
Question
* CENGAGE MINDTAP
Q Search this course
Programming Exercise 3-8
Instructions
PaintCalculator.java
+
>- Terminal
1 import java.util.Scanner;
sandbox $ ||
2 public class PaintCalculator {
Assume that a gallon of paint covers about 350 square feet of wall
public static void main (String args[]) {
// Write your code here
3
space. Create an application with a main() method that prompts
4
the user for the length, width, and height of a rectangular room.
}
</>
Pass these three values to a method that does the following:
6
public static double computeArea(double length, double width, double height) {
// Write your code here
7
8
• Calculates the wall area for a room
}
public static double computeGallons(double area) {
// Write your code here
9
• Passes the calculated wall area to another method that
10
11
calculates and returns the number of gallons of paint needed
12
}
• Displays the number of gallons needed
13 }
• 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
Transcribed Image Text:* CENGAGE MINDTAP Q Search this course Programming Exercise 3-8 Instructions PaintCalculator.java + >- Terminal 1 import java.util.Scanner; sandbox $ || 2 public class PaintCalculator { Assume that a gallon of paint covers about 350 square feet of wall public static void main (String args[]) { // Write your code here 3 space. Create an application with a main() method that prompts 4 the user for the length, width, and height of a rectangular room. } </> Pass these three values to a method that does the following: 6 public static double computeArea(double length, double width, double height) { // Write your code here 7 8 • Calculates the wall area for a room } public static double computeGallons(double area) { // Write your code here 9 • Passes the calculated wall area to another method that 10 11 calculates and returns the number of gallons of paint needed 12 } • Displays the number of gallons needed 13 } • 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
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Unreferenced Objects
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT