Develop a computer program in the Java language to create classes of Rectangle, Triangle, and Circle that inherit from the generic class called Shape. ??
Develop a computer program in the Java language to create classes of Rectangle, Triangle, and Circle that inherit from the generic class called Shape.
??
?
PROGRAMMING II: CLASSROOM ACTIVITY (CA-05/06) DUE 5:00 PM FRIDAY MARCH 27, 2020 Following the suggestions from class regarding Classroom Activity assignments, I assign this mini project as your Classroom Activity 5 (CA-05). As indicated at the top of the page, this mini project is due Friday, March 27, 2020 by 5:00 pm. The goal of this project is to gain more in-depth experience with inheritance concepts. You will develop a computer program in the Java language to create classes of Rectangle, Triangle, and Circle that inherit from the generic class called Shape. The class Shape is characterized by the UML diagram shown below. Shape -color: String -filled: boolean +Shape() +Shape(color: String, filled: boolean) +getColor(): String +setColor(color: String): double +getFilled(): boolean) +setFilled(filled: boolean): void +toString(): String The color of this shape (default white) whether filled with a color (default false) Constructs a default Shape Constructs a shape of specified color and filled values Returns the color Sets a new color Returns the filled property Sets the filled property Returns a string representation of this shape Use your favorite IDE to write and run a Java program that performs the tasks described below. Submit the source code on Canvas no later then 5:00 pm Friday, March 27, 2020. 1. Create the driver class named Test Shapes (source code given at the end of this document) in a file named TestShapes.java that will include a total of five classes, named: 1) Test Shapes; 2) Shape; 3) Rectangle; 4) Circle; and 5) Triangle. 2. The class Shape must be created according to the the UML diagram above. Make sure you provide constructor(s), accessor method(s), and mutator method(s). 3. The class Rectangle must be created as a subclass of the Shape class and must contain (in addition to the constructor(s) and accessor and mutator methods for each data field): a. The data field length of type double; b. The data field width of type double; c. The method named get Perimeter () that returns the perimeter of the rectangle as a double; and d. The toString() method that overrides the corresponding method in the Shape class.
Step by Step Solution
3.46 Rating (153 Votes )
There are 3 Steps involved in it
Step: 1
Class1 Shape colorString Methods getArea double toString String Superclass defines the expected behaviorspublic intertace of all subclasses Program at ...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