Write a java set of classes that could be used to do simple calculations on geometric objects. The set should include the following classes: a) Shapes ,containing abstract methods( a methods that is declared without an implementation) area and perimeter b) Rectangle, a subclass of Shape, containing a constructor (with parameters for length and width) along with methods area and perimeter. c) Triangle, a subclass of Shape, containing a constructor (with parameters for the three sides of a triangle) along with methods area ( s = (a+b+c)/2, A = sqrt( s(s-a)(s- b)(s-c) ) ) and perimeter d) Square, a subclass of Rectangle, containing a constructor (with a parameter for the length of a side) and methods that invoke the methods of the Rectangle class to determine the perimeter and area of a square.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter11: Inheritance And Composition
Section: Chapter Questions
Problem 6PE
icon
Related questions
Question

JAVA CODE

Write a java set of classes that could be used to do simple calculations on geometric
objects. The set should include the following classes:


a) Shapes ,containing abstract methods( a methods that is declared without an
implementation) area and perimeter

b) Rectangle, a subclass of Shape, containing a constructor (with parameters for
length and width) along with methods area and perimeter.

c) Triangle, a subclass of Shape, containing a constructor (with parameters for the

three sides of a triangle) along with methods area ( s = (a+b+c)/2, A = sqrt( s(s-a)(s-
b)(s-c) ) ) and perimeter

d) Square, a subclass of Rectangle, containing a constructor (with a parameter for the
length of a side) and methods that invoke the methods of the Rectangle class to
determine the perimeter and area of a square.

Expert Solution
steps

Step by step

Solved in 4 steps with 5 images

Blurred answer
Knowledge Booster
Developing computer interface
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
Systems Architecture
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning