197k views
3 votes
In order to paint a wall that has a number of windows, we want to know its area. Each window has a size of 2 ft by 3 ft. Write a program that reads the width and height of the wall and the number

of windows, using the prompts
Wall width:
Wall height:
Number of windows:
Then print the area.
Complete the following file:
WallArea.java
import java.util.Scanner
public class WallArea
{
public static void main(String[] args)
Scanner sc = new Scanner(System.in);
// and the number of windows
// Compute the area of the wall without the windows
System.out.println("Area: " + area);
}

1 Answer

2 votes

Final answer:

To calculate the area of the wall without the windows, multiply the width and height of the wall. Subtract the total area of the windows from the total area of the wall.

Step-by-step explanation:

To calculate the area of the wall without the windows, you can multiply the width and height of the wall. The area formula is length times width.

First, you need to read the width, height, and number of windows using the Scanner class in Java.

Then, you can compute the area of the wall without the windows by subtracting the total area of the windows from the total area of the wall.

User Jeff Erickson
by
8.6k points