Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

USING JAVA: (1) Prompt the user to input a wall's height and width. Calculate and output the wall's area. (2 pts) Note: This zyLab outputs

image text in transcribed

USING JAVA: (1) Prompt the user to input a wall's height and width. Calculate and output the wall's area. (2 pts) Note: This zyLab outputs a newline after each user-input prompt. For convenience in the examples below, the user's input value is shown on the next line, but such values don't actually appear as output when the program runs.

Enter wall height (feet): 12.0 Enter wall width (feet): 15.0 Wall area: 180.0 square feet 

(2) Extend to also calculate and output the amount of paint in gallons needed to paint the wall. Assume a gallon of paint covers 350 square feet. Store this value using a final double variable. (2 pts)

Enter wall height (feet): 12.0 Enter wall width (feet): 15.0 Wall area: 180.0 square feet Paint needed: 0.5142857142857142 gallons 

(3) Extend to also calculate and output the number of 1 gallon cans needed to paint the wall. Hint: Use a math function to round up to the nearest gallon. (2 pts)

Enter wall height (feet): 12.0 Enter wall width (feet): 15.0 Wall area: 180.0 square feet Paint needed: 0.5142857142857142 gallons Cans needed: 1 can(s)
Load derauit template... 7 1 import java.util.Scanner; 2 import java.lang. Math; // Note: Needed for math functions in part (3) 3 4 public class PaintEstimator { 5 public static void main(String[] args) { 6 Scanner scnr = new Scanner(System.in); double wallHeight; 8 double wallwidth; 9 double wallArea; 10 11 System.out.println("Enter wall height (feet):"); 12 wallHeight = scnr.nextDouble(); 13 14 wallwidth = 10.0; // FIXME (1): Prompt user to input wall's width 15 16 // Calculate and output wall area 17 wallArea = 0.0; // FIXME (1): Calculate the wall's area 18 System.out.println("Wall area: "); // FIXME (1): Finish the output statement 19 20 // FIXME (2): Calculate and output the amount of paint in gallons needed to paint the wall 21 22 // FIXME (3): Calculate and output the number of 1 gallon cans needed to paint the wall, rounded up to nearest integer 23 } 24 }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Pro PowerShell For Database Developers

Authors: Bryan P Cafferky

1st Edition

1484205413, 9781484205419

More Books

Students also viewed these Databases questions

Question

Write short notes on departmentation.

Answered: 1 week ago

Question

What are the factors affecting organisation structure?

Answered: 1 week ago

Question

What are the features of Management?

Answered: 1 week ago

Question

Briefly explain the advantages of 'Management by Objectives'

Answered: 1 week ago

Question

Explain the function and purpose of the Job Level Table.

Answered: 1 week ago