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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!