67 216
Assignments Done
99,2%
Successfully Done
In November 2018

Answer to Question #33427 in Java | JSP | JSF for Jimbo

Question #33427
Write an AreaTester program that constructs a Rectangle object and then computes and prints its area. Use the getWidth and getHeight methods. Also print the unexpected answer.
Expert's answer
public class Rectangle {

private double width;
private double hight;

Rectangle(double width, double hight){
this.width= width;
this.hight= hight;
}

publicdouble getWidth() {
returnwidth;
}

publicdouble getHight() {
returnhight;
}

}

public class AreaTester {
publicstatic void main(String[] args) {
Rectanglerectangle = new Rectangle(13.0, 5.9);
doublearea = rectangle.getWidth() * rectangle.getHight();
System.out.println(area);
}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions