SlideShare una empresa de Scribd logo
1 de 4
Object Oriented Programming
OOP
Consider the following class hierarchy:
● The classes Two-dimensional and Three-dimensional should be defined as
abstract classes, under the super class “Shape”.
● toString() should be defined for each Figure to return the “Type of Figure”
and the relevant data for that class as String.
● The class Two-dimensional contains the methods getArea() and
getCircumference().
where
Triangle:
Area = ½ * Base * Height
Circumference = Side1 + Side2 + Side3
Rectangle:
Area = Height * Width
Circumference = 2* (Height + Width)
Circle:
Area = pi * Radius * Radius
Circumference = 2* Pi * Radius
● The class Three-dimensional contains the methods
getSurface() and getVolume().
where
Box:
Surface= 2*(Height * Width + Width * Length
+ Length * Height)
Volume= Height * Width * Length
Cone:
Surface= 2 * pi * Radius (Radius + Height)
Volume= 1/3 * pi * Radius * Radius * Height
Cylinder:
Surface= 2 * pi * Radius (Radius + Height)
Volume= pi * Radius * Radius * Height
Sphere:
Surface= 4 * pi * Radius * Radius
Volume= 4/3 * pi * Radius * Radius * Radius
●Implement the above classe in Java
(Include default constructors, destructors, access
methods and other functions required for the above
classes) (70 marks)
●Write a test program to test the above classes by creating
objects for each child classes.
(30 marks)

Más contenido relacionado

Similar a Exam 01 oop.pptx

Volume and surface area formulae
Volume and surface area formulaeVolume and surface area formulae
Volume and surface area formulaesidraqasim99
 
E2209310017_Mathematics_B.Ed II Year.ppt
E2209310017_Mathematics_B.Ed II Year.pptE2209310017_Mathematics_B.Ed II Year.ppt
E2209310017_Mathematics_B.Ed II Year.pptssuser917ddb
 
Lecture-03 _Java Classes_from FAST-NUCES
Lecture-03 _Java Classes_from FAST-NUCESLecture-03 _Java Classes_from FAST-NUCES
Lecture-03 _Java Classes_from FAST-NUCESUzairSaeed18
 
Basic Mensuration
Basic MensurationBasic Mensuration
Basic MensurationKaran Bora
 
C++ classes tutorials
C++ classes tutorialsC++ classes tutorials
C++ classes tutorialsFALLEE31188
 
Csphtp1 09
Csphtp1 09Csphtp1 09
Csphtp1 09HUST
 
area and perimeter.ppt
area and perimeter.pptarea and perimeter.ppt
area and perimeter.pptShefaCapuras1
 
area and perimeter (2).ppt
area and perimeter (2).pptarea and perimeter (2).ppt
area and perimeter (2).pptShefaCapuras1
 
Geometry 1st Edition Kindle Edition by Elayn Martin Gay Solutions Manual
Geometry 1st Edition Kindle Edition by Elayn Martin Gay Solutions ManualGeometry 1st Edition Kindle Edition by Elayn Martin Gay Solutions Manual
Geometry 1st Edition Kindle Edition by Elayn Martin Gay Solutions Manualrohalcabaye
 
Abstract Classes Interface Exceptional Handling Java
Abstract Classes Interface Exceptional Handling JavaAbstract Classes Interface Exceptional Handling Java
Abstract Classes Interface Exceptional Handling JavaSyedShahroseSohail
 

Similar a Exam 01 oop.pptx (19)

Volume and surface area formulae
Volume and surface area formulaeVolume and surface area formulae
Volume and surface area formulae
 
Object and class
Object and classObject and class
Object and class
 
E2209310017_Mathematics_B.Ed II Year.ppt
E2209310017_Mathematics_B.Ed II Year.pptE2209310017_Mathematics_B.Ed II Year.ppt
E2209310017_Mathematics_B.Ed II Year.ppt
 
Lecture-03 _Java Classes_from FAST-NUCES
Lecture-03 _Java Classes_from FAST-NUCESLecture-03 _Java Classes_from FAST-NUCES
Lecture-03 _Java Classes_from FAST-NUCES
 
Basic Mensuration
Basic MensurationBasic Mensuration
Basic Mensuration
 
Second chapter-java
Second chapter-javaSecond chapter-java
Second chapter-java
 
Developemnt
DevelopemntDevelopemnt
Developemnt
 
C++ classes tutorials
C++ classes tutorialsC++ classes tutorials
C++ classes tutorials
 
3433 Ch09 Ppt
3433 Ch09 Ppt3433 Ch09 Ppt
3433 Ch09 Ppt
 
Csphtp1 09
Csphtp1 09Csphtp1 09
Csphtp1 09
 
area and perimeter.ppt
area and perimeter.pptarea and perimeter.ppt
area and perimeter.ppt
 
area and perimeter (2).ppt
area and perimeter (2).pptarea and perimeter (2).ppt
area and perimeter (2).ppt
 
Geometry 1st Edition Kindle Edition by Elayn Martin Gay Solutions Manual
Geometry 1st Edition Kindle Edition by Elayn Martin Gay Solutions ManualGeometry 1st Edition Kindle Edition by Elayn Martin Gay Solutions Manual
Geometry 1st Edition Kindle Edition by Elayn Martin Gay Solutions Manual
 
Area powerpoint
Area powerpointArea powerpoint
Area powerpoint
 
Area powerpoint
Area powerpointArea powerpoint
Area powerpoint
 
JAVA OOP
JAVA OOPJAVA OOP
JAVA OOP
 
L1 Circle.pptx
L1 Circle.pptxL1 Circle.pptx
L1 Circle.pptx
 
Abstract Classes Interface Exceptional Handling Java
Abstract Classes Interface Exceptional Handling JavaAbstract Classes Interface Exceptional Handling Java
Abstract Classes Interface Exceptional Handling Java
 
24. area
24. area24. area
24. area
 

Último

Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajanpragatimahajan3
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfchloefrazer622
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
The byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxThe byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxShobhayan Kirtania
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 

Último (20)

Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
The byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxThe byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptx
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 

Exam 01 oop.pptx

  • 2. Consider the following class hierarchy: ● The classes Two-dimensional and Three-dimensional should be defined as abstract classes, under the super class “Shape”. ● toString() should be defined for each Figure to return the “Type of Figure” and the relevant data for that class as String. ● The class Two-dimensional contains the methods getArea() and getCircumference().
  • 3. where Triangle: Area = ½ * Base * Height Circumference = Side1 + Side2 + Side3 Rectangle: Area = Height * Width Circumference = 2* (Height + Width) Circle: Area = pi * Radius * Radius Circumference = 2* Pi * Radius ● The class Three-dimensional contains the methods getSurface() and getVolume(). where Box: Surface= 2*(Height * Width + Width * Length + Length * Height) Volume= Height * Width * Length Cone: Surface= 2 * pi * Radius (Radius + Height) Volume= 1/3 * pi * Radius * Radius * Height Cylinder: Surface= 2 * pi * Radius (Radius + Height) Volume= pi * Radius * Radius * Height Sphere: Surface= 4 * pi * Radius * Radius Volume= 4/3 * pi * Radius * Radius * Radius
  • 4. ●Implement the above classe in Java (Include default constructors, destructors, access methods and other functions required for the above classes) (70 marks) ●Write a test program to test the above classes by creating objects for each child classes. (30 marks)