Create a class named GeometricShape containing Two data fields shapeType (a string) area (of type double)

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Create a class named GeometricShape containing  

Two data fields

 shapeType (a string)

area (of type double)

A no-argument constructor to initialize all data fields with default values “NoShape” and 0.0. A member function named show() to display the details associated with an instance of this class . Derive a class named Rectangle from class GeometricShape that includes Data members:

 Length(int)

 Width(int)

Respective mutater and accessor functions to set and get values of length and width, and function named computeArea() to compute the area of rectangle (length x width)  and function named show() to display the details associated with an instance of class Rectangle  and also its shape type attribute from parent class .From the Rectangle class, derive a class named Cuboid that contains  A data field named height in addition to length and width. A three arguments constructor to initialize the values (use super key word for length and width).Two functions named setHeight() and getHeight() to set and get value of height data field, and  function named computeArea() to calculate the area of a cuboid (length x width x height)  And function named show() to display the details associated with an instance of class Cuboid  and also shape type attribute from Shape class.

Implement these classes and in the main class with main method create instances of each class first set the values through setter function or constructors (take input from user).and then call the computeArea() and show()  methods of Rectangle and Cuboid class through there instances.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Class
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
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education