Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Excel As Your Database

Authors: Paul Cornell

1st Edition

1590597516, 978-1590597514

More Books

Students also viewed these Databases questions