Answer to Question #33427 in Java | JSP | JSF for Jimbo
2013-07-20T12:55:36-04:00
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.
1
2013-07-23T09:24:34-0400
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 !
Learn more about our help with Assignments:
Java JSP JSF
Comments
Leave a comment