Task 3.3: Class: Pyramid Create a class called "Pyramid", which is inherited from "ThreeDimensionShape" abstract class. The "Pyramid" class is used to calculate the surface-area and the volume of a "Pyramid" when its height (h), length of the base (b), and side (s) are given. The specifications of this class are below. • Surface Area 2bs + b? • Volume = 1/3 b²h Where: o b: The length of the base. oh: The height, is the distance from the base to the center point of the pyramid. Os: The side, is the length of one face of the pyramid, from the base to the top point. > Data Members (Attributes) and their description: All are private. • Length (b): The length of the base. • Height (h): the height of the cylinder. • Side (s): The side, is the length of one face of the pyramid, from the base to the top point. > Methods/Operations/Getters/Setters: • Default Constructor: when creating object this constructor must set the length, height, and the side of the pyramid by calling the methods setLength(), setHeight(), and setSide(). Moreover, calculateSurfaceArea(), calculateVolume(), and summaryPrint() to print all needed information on the screen. this constructor will invoke the methods • User-Defined Constructor: when creating object this constructor must calculate the surface-area and the volume of a pyramid by given its length, height, and side as parameters. Moreover, this constructor will call the methods calculateSurfaceArea(), calculateVolume(), and summaryPrint(), to calculate and display all the needed information on the screen. • Method setLength(): to set the length of the pyramid, by the keyboard. Entered values must be validated, otherwise, repetition occurs (must be re-entered again). • Method setHeight(): to set the height of the pyramid, by the keyboard. Entered values must be validated, otherwise, repetition occurs (must be re-entered again). • Method setSide(): to set the side of the pyramid, by the keyboard. Entered values must be validated, otherwise, repetition occurs (must be re-entered again). • Method calculateSurfaceArea(0: must override the abstract method, calculateSurfaceArea(), to calculate the surface area of the pyramid. • Method calculateVolume(): must override the abstract method, calculateVolume(), to calculate the volume of the pyramid. • Method summaryPrint(): must override the abstract method, summaryPrint(), to print all information on the screen.

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
100%

Java Programs 

Task 3.3: Class: Pyramid
Create a class called "Pyramid", which is inherited from "ThreeDimensionShape" abstract
class. The "Pyramid" class is used to calculate the surface-area and the volume of a
"Pyramid" when its height (h), length of the base (b), and side (s) are given. The
specifications of this class are below.
• Surface Area 2bs + b?
• Volume = 1/3 b²h
Where:
o b: The length of the base.
oh: The height, is the distance from the base to
the center point of the pyramid.
Os: The side, is the length of one face of the
pyramid, from the base to the top point.
> Data Members (Attributes) and their description: All are private.
• Length (b): The length of the base.
• Height (h): the height of the cylinder.
• Side (s): The side, is the length of one face of the pyramid, from the base to the top
point.
> Methods/Operations/Getters/Setters:
• Default Constructor: when creating object this constructor must set the length,
height, and the side of the pyramid by calling the methods setLength(), setHeight(),
and setSide(). Moreover,
calculateSurfaceArea(), calculateVolume(), and summaryPrint() to print all needed
information on the screen.
this constructor
will invoke the methods
• User-Defined Constructor: when creating object this constructor must
calculate the surface-area and the volume of a pyramid by given its length, height,
and side as parameters. Moreover, this constructor will call the methods
calculateSurfaceArea(), calculateVolume(), and summaryPrint(), to calculate and
display all the needed information on the screen.
• Method setLength(): to set the length of the pyramid, by the keyboard. Entered
values must be validated, otherwise, repetition occurs (must be re-entered again).
• Method setHeight(): to set the height of the pyramid, by the keyboard. Entered
values must be validated, otherwise, repetition occurs (must be re-entered again).
• Method setSide(): to set the side of the pyramid, by the keyboard. Entered values
must be validated, otherwise, repetition occurs (must be re-entered again).
• Method calculateSurfaceArea(0: must override the abstract method,
calculateSurfaceArea(), to calculate the surface area of the pyramid.
• Method calculateVolume(): must override the abstract method, calculateVolume(),
to calculate the volume of the pyramid.
• Method summaryPrint(): must override the abstract method, summaryPrint(), to
print all information on the screen.
Transcribed Image Text:Task 3.3: Class: Pyramid Create a class called "Pyramid", which is inherited from "ThreeDimensionShape" abstract class. The "Pyramid" class is used to calculate the surface-area and the volume of a "Pyramid" when its height (h), length of the base (b), and side (s) are given. The specifications of this class are below. • Surface Area 2bs + b? • Volume = 1/3 b²h Where: o b: The length of the base. oh: The height, is the distance from the base to the center point of the pyramid. Os: The side, is the length of one face of the pyramid, from the base to the top point. > Data Members (Attributes) and their description: All are private. • Length (b): The length of the base. • Height (h): the height of the cylinder. • Side (s): The side, is the length of one face of the pyramid, from the base to the top point. > Methods/Operations/Getters/Setters: • Default Constructor: when creating object this constructor must set the length, height, and the side of the pyramid by calling the methods setLength(), setHeight(), and setSide(). Moreover, calculateSurfaceArea(), calculateVolume(), and summaryPrint() to print all needed information on the screen. this constructor will invoke the methods • User-Defined Constructor: when creating object this constructor must calculate the surface-area and the volume of a pyramid by given its length, height, and side as parameters. Moreover, this constructor will call the methods calculateSurfaceArea(), calculateVolume(), and summaryPrint(), to calculate and display all the needed information on the screen. • Method setLength(): to set the length of the pyramid, by the keyboard. Entered values must be validated, otherwise, repetition occurs (must be re-entered again). • Method setHeight(): to set the height of the pyramid, by the keyboard. Entered values must be validated, otherwise, repetition occurs (must be re-entered again). • Method setSide(): to set the side of the pyramid, by the keyboard. Entered values must be validated, otherwise, repetition occurs (must be re-entered again). • Method calculateSurfaceArea(0: must override the abstract method, calculateSurfaceArea(), to calculate the surface area of the pyramid. • Method calculateVolume(): must override the abstract method, calculateVolume(), to calculate the volume of the pyramid. • Method summaryPrint(): must override the abstract method, summaryPrint(), to print all information on the screen.
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
Introduction to computer system
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.
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