Question: 1. Design an abstract class named Polygon that contains: a. A private String data field named color (default white) b. A private boolean data field

 1. Design an abstract class named Polygon that contains: a. A

1. Design an abstract class named Polygon that contains: a. A private String data field named color (default "white") b. A private boolean data field named filled (default false) c. The accessor and mutator methods for color and filled. d. The following an abstract method: public abstract double getArea(); public abstract double getSides(); e. Create a subclass Triangle, Rectangle that extends the Polygon class and implement the following: f. Create a private double data field named base, height. g. A constructor that initializes the base and height fields. h. The accessor and mutator methods for base and height. i. Implement the getArea() method to return the area of Triangle. j. Implement the getSides() method to return the side of Triangle. k. Create a Triangle and Rectangle objects and show the state of each object Programs Set-2 1. Write a program in Java that performs following tasks: a. Creates a class called Person having attributes personName,personID. b. Creates a subclass called Student of Person class having attributes stdGPA, stdMajor. c. Creates a subclass called Teacher of Person class having attributes teacherCourse, teacherSalary. d. Write the constructors for Person, Student and Teacher class to initialize the attributes(fields). e. Write a method displayDetails() in Student and Teacher class to print all attributes of superclass and subclass

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!