Question: Hello, I want the return statement to be printed out. But only the # of desks are currently being printed out as you can see
Hello, I want the return statement to be printed out. But only the # of desks are currently being printed out as you can see in the output. How do I get the return statement from Rectangle.java to be printed to the screen? Desks in a Room
Main.java
Rectangle java
public class Main
public static void mainString args
step : find the total area of the space
int totalArea ;
step : find the area of a desk
Rectangle desk new Rectangle;
int deskArea desk.getArea:
step : divide the area of space by the area of a desk
int numDesks totalArea deskArea;
step : print out the number of desks!
Systen. out.print lnnumDesks;
I
Desks in a Room
Main.java
Rectangle.java
public class Rectangle
private int width;
private int height;
public Rectangleint rectwidth, int rectHeight
width rectWidth;
height rectHeight;
public void printArea
int area width height;
Systen.out.printlnarea;
public int getArea
int area width height;
return area;
public void setHeightint newHeight
height newHeight;
public void setwidthint newwidth
width newWidth;
public String toString
return "Rectangle with width: width and height: height;
Desks in a Room
public static void mainString args
step : find the total area of the space
int totalArea ;
step : find the area of a desk
Rectangle desk new Rectangle;
int deskArea desk.getArea;
step : divide the area of space by the area of a desk
int numDesks totalArea deskArea;
step : print out the number of desks!
System.out.printlnnumDesks;
public class Rectangle
private int height;
public Rectangleint rectWidth, int rectHeight
width rectWidth;
height rectHeight;
public void printArea
int area width height;
System.out.printlnarea;
public int getArea
int area width height;
return area;
public void setHeightint newHeight
height newHeight;
public void setWidthint newWidth
width newWidth;
public String toString
return "Rectangle with width: width and height: height;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
