Question
Abstract Classes: Shapes Objectives Practice OO programming and inheritance. Introduce abstract classes. Implement (override) some abstract methods from an abstract class. Practice using of the
Abstract Classes: Shapes
Objectives
Practice OO programming and inheritance.
Introduce abstract classes.
Implement (override) some abstract methods from an abstract class.
Practice using of the Comparable interface for sorting.
Getting Started
Make a project called L9 then download and import Shapes-starter.jar
Download Shapes-starter.jar here: http://www.cs.colostate.edu/~cs165/.Spring18/recitations/L9/archive/Shapes-starter.jar
Your directory should look like this:
W5L2/ src Circle.java Point.java Shape.java Rectangle.java TestProgram.java Triangle.java
Instructions
Note that the Shape class is abstract and cannot be instantiated.
Use the javadoc to implement the Circle, Rectangle, and Triangle classes, one at a time.
javadoc found here: http://www.cs.colostate.edu/~cs165/.Spring18/recitations/L9/doc/javadoc
If youre unsure what mathematical formulas to use in the classes, google it.
Test each class incrementally.
The instance variables, equals, hashCode, and toString methods are provided for you.
Uncomment the toString method at the end of implementing each class.
Implement the compareTo method in the abstract Shape class.
Finish testing and then answer the questions in the main method of the TestProgram.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started