oop lab-36209
oop lab-36209
Lab#07
Submitted By
Bilal Ahmed
RIT-9245005
Submitted To
Miss Sobia Yousaf
Task 01:
Create a Java class named "animal" that has three data members i.e
name, age, noise. It includes public methods for getting name and
speak() to display the data members values. Create a child class named
Bird having to attributes height and color.it also includes two member
methods print_bird() and speak() that displays the information of animal
and bird.
Input Screen:
NATIONAL UNIVERSITY OF MODERN LANGUAGES - RAWALPINDI
Department of Software Engineering
Output Screen:
NATIONAL UNIVERSITY OF MODERN LANGUAGES - RAWALPINDI
Department of Software Engineering
Task 02:
Create three classes Food, Fruit and Apple in such a way that class Apple
extends Fruit class and Fruit class extends class Food. Create a
constructor in each class containing only a statement to print current
class name. Call all the three constructors using constructor chaining.
Input Screen:
Output Screen:
NATIONAL UNIVERSITY OF MODERN LANGUAGES - RAWALPINDI
Department of Software Engineering
Task 03:
Create a class named SimpleGeometricObject and two subclasses
RectangleFromSimpleGeometricObject and CirclefromGeometricObject.
Add a new method drawShape( ) in SimpleGeometricObject (i.e.,
superclass) Class and over-rides this method into subclass i.e.,
RectangleFromSimpleGeometricObject and CirclefromGeometricObject
to draw a specific shape according to subclass specification.
Input Screen:
NATIONAL UNIVERSITY OF MODERN LANGUAGES - RAWALPINDI
Department of Software Engineering
Output Screen:
NATIONAL UNIVERSITY OF MODERN LANGUAGES - RAWALPINDI
Department of Software Engineering