Home
Site Map
Useful Tools
Graphing Calc
Scientific Calculator
|
Super Classes Are Great
Implement all methods of the Rectangle and Triangle classes described below. Then download InteractiveMath and implement its methods
Class: Rectangle
instance Variables
- private int color;
- private double width;
- private double height ;
Accesor Methods
- public double getArea(); //returns the area of the rectangle
- public int getColor()
Class: Triangle
instance Variables
- private int color;
- private double height ;
- private double width;
Accesor Methods
- public double getArea(); //returns the area of the triangle
- public int getColor()
- public double getAltitudeLength() //returns the length of the altitude
instance Variables
-
ArrayList<Rectangle> rectangles;
- ArrayList<Triangle> triangles;
Accesor Methods
- public double computeNetArea(){ //@ returns the area of the rectangles and triangles
|
What is inconvenient about the way that we have to structure the InteractiveMath.java code?
|
Part II: Improving our Class Structures
|