Day 2: Assignment – OOPs Concepts Solved

39.99 $

Category: Tags: , , , , , ,
Click Category Button to View Your Next Assignment | Homework

You'll get a download link with a: zip solution files instantly, after Payment

Securely Powered by: Secure Checkout

Description

5/5 - (1 vote)

Problem statement – Create an abstract class – Animal having the following properties and getter/setter methods and other behavior methods..
name : String
no-args constructor
constructor initializing all fields
getter/setter methods
makeNoise() – abstract method
sleep() – print any statement using println() method in this method i.e. Animal is
sleeping
eat() – abstract method
Now create two classes extending Animal as base class as following
Dog class
breed : String
no-args constructor
constructor initializing all fields of this class
constructor initializing field of this + name of super class
getter/setter methods
Override makeNoise() and eat() methods
define new method – play() : void (it should print any statement i.e. – Dog is playing)
Day 2: Assignment – OOPs Concepts1 Cat class
nickName: String
no-args constructor
constructor initializing all fields of this class
constructor initializing field of this + name of super class
getter/setter methods
Override makeNoise() and eat() methods
define new method – jump() : void (it should print any statement i.e. – Cat is jumping)
Main class
should have the main() method
create objects of Cat and Dog using superclass reference variable
i.e. Animal animal = new Cat();
try to call all the methods on the object reference variable and observe the output
NOTE: The objective of the above problem statement is to get understanding on the following concepts
Objects and relationship (inheritance)
Role of constructors in inheritance
Concepts of overriding and overloading methods
use of super keyword to initialize objects properly from subclass instance
Type Casting supertype into subtype
Understanding polymorphism, encapsulation, inheritance
Day 2: Assignment – OOPs Concepts2

  • Day-2-lzpwz8.zip