SlideShare a Scribd company logo
Second Part
Q1.
Create two classes named Mammals and MarineAnimals. Create another class named BlueWhale
which inherits both the above classes. Now, create a function in each of these classes which prints "I
am mammal", "I am a marine animal" and "I belong to both the categories: Mammals as well as
Marine Animals" respectively. Now, create an object for each of the above class and try calling
1 - function of Mammals by the object of Mammal
2 - function of MarineAnimal by the object of MarineAnimal
3 - function of BlueWhale by the object of BlueWhale
4 - function of each of its parent by the object of BlueWhale
OVERVIEW
Mammals Marine Animals
Base class Base class
Blue Whale
Derived class
This class is inheriting the data and
member of both ‘Mammals’ and
‘Marine Animals’
Multiple
inheritance
Multiple Inheritance:- In this type of inheritance there are more than one base class and only one derived class,
Which inherits the property and methods of parents class.
Now
We have to declare function in each of the classes mammal, marineanimal and
blue whale and do as the question says,
And lastly declare the object of mammal, marineanimal and bluewhale and try
calling function of each of its parent by the object of BlueWhale.
Q2.
Make a class named Fruit with a data member to calculate the number of fruits in a basket.
Create two other class named Apples and Mangoes to calculate the number of apples and
mangoes in the basket. Print the number of fruits of each type and the total number of fruits in
the basket.
OVERVIEW
Fruit
Apples Mangoes
Base class
Derived class Derived class
Hierarchical
inheritance
Hierarchical
inheritance
Hierarchical inheritance:- In this type of inheritace there are single base class and multiple derived . i.e Both
the derived class inherits the property and methods of single base class.
Now
Create data member according to questions.
.
.
.
.
.
And lastly create the object of derived class.
Q3.
We want to calculate the total marks of each student of a class in Physics
,Chemistry and Mathematics and the average marks of the class. The
number of students in the class are entered by the user. Create a class
named Marks with data members for roll number, name and marks. Create
three other classes inheriting the Marks class, namely Physics, Chemistry
and Mathematics, which are used to define marks in individual subject of
each student. Roll number of each student will be generated automatically.
OVERVIEW
Marks
physics chemistry mathematics
Base class
Derived class Derived class Derived class
Hierarchical
inheritance
Hierarchical inheritance:- In this type of inheritace there are single base class and multiple derived . i.e Both
the derived class inherits the property and methods of single base class.
Now declare data member as the question says.
Marks:-
data members for roll number, name and marks.
Q.4
We want to store the information of different vehicles. Create a class named Vehicle with two data member
named mileage and price. Create its two subclasses
*Car with data members to store ownership cost, warranty (by years), seating capacity and fuel type (diesel or
petrol).
*Bike with data members to store the number of cylinders, number of gears, cooling type(air, liquid or oil), wheel
type(alloys or spokes) and fuel tank size(in inches)
Make another two subclasses Audi and Ford of Car, each having a data member to store the model type. Next,
make two subclasses Bajaj and TVS, each having a data member to store the make-type.
Now, store and print the information of an Audi and a Ford car (i.e. model type, ownership cost, warranty, seating
capacity, fuel type, mileage and price.) Do the same for a Bajaj and a TVS bike.
Vehicle
OVERVIEW
CAR BIKE
TVS
BAJAJ
FORD
AUDI
mileage and
price.
Hierarchical
inheritance
Hierarchical
inheritance
# Car with data members to store ownership cost, warranty (by years), seating capacity and fuel type (diesel or
petrol).
.
#Bike with data members to store the number of cylinders, number of gears, cooling type(air, liquid or oil), wheel
type(alloys or spokes) and fuel tank size(in inches).
#Make another two subclasses Audi and Ford of Car, each having a data member to store the model type. Next,
make two subclasses Bajaj and TVS, each having a data member to store the make-type.
5.
Create a class named Shape with a function that prints "This is a shape". Create another class named Polygon
inheriting the Shape class with the same function that prints "Polygon is a shape". Create two other classes
named Rectangle and Triangle having the same function which prints "Rectangle is a polygon" and "Triangle is
a polygon" respectively. Again, make another class named Square having the same function which prints
"Square is a rectangle".
Now, try calling the function by the object of each of these classes.
OVERVIEW
Shape
polygons
Rectangle Triangle
polygons
HYBRID INHERITANCE
 HYBRID INHERITANCE:-It is the
combination of multiple and
multilevel inheritance . Means
two child class inherits the
property and method of
parent class. And then a
another child class inherit the
property of previous two child
class.
Q.6
All the banks operating in India are controlled by RBI. RBI has set a well defined guideline (e.g. minimum interest
rate, minimum balance allowed, maximum withdrawal limit etc) which all banks must follow. For example, suppose
RBI has set minimum interest rate applicable to a saving bank account to be 4% annually; however, banks are free
to use 4% interest rate or to set any rates above it.
Write a program to implement bank functionality in the above scenario. Note: Create few classes namely Customer,
Account, RBI (Base Class) and few derived classes (SBI, ICICI, PNB etc). Assume and implement required member
variables and functions in each class
RBI
OVERVIEW
SBI ICICI PNB
Hierarchical inheritance
RBI
Declare variable minimum interest rate, minimum balance allowed, maximum
withdrawal limit
And declare function to define this variable.

More Related Content

PDF
Principles of Economics 7th Edition Gottheil Solutions Manual
PPT
8815346
DOCX
GCU Colangelo College of BusinessForm 10-K Tutorial
PPTX
inheritance and polymorphism
PDF
Principles of Microeconomics 7th Edition Gregory Mankiw Solutions Manual
PDF
Principles of Microeconomics 7th Edition Gregory Mankiw Solutions Manual
PDF
MOCA Enterprise Deep Dive - Pressmart
DOCX
Shelly CashmanPowerPointChapter 1SAM Project 1aShelly Cashman.docx
Principles of Economics 7th Edition Gottheil Solutions Manual
8815346
GCU Colangelo College of BusinessForm 10-K Tutorial
inheritance and polymorphism
Principles of Microeconomics 7th Edition Gregory Mankiw Solutions Manual
Principles of Microeconomics 7th Edition Gregory Mankiw Solutions Manual
MOCA Enterprise Deep Dive - Pressmart
Shelly CashmanPowerPointChapter 1SAM Project 1aShelly Cashman.docx

Similar to Overview of ECE Engineer (20)

PPTX
Bashayer othman
PDF
Student Voice
PPTX
Class as the Basis of all Computation.pptx
PDF
Advanced software engineering lab 2
PDF
Core java-course-content
PDF
Core java-course-content
PDF
Core java-training-course-content
PDF
E4
PDF
general mathematics.pdf
DOCX
Root cause of community problem for this discussion, you will i
DOCX
PED 212 Education Organization / snaptutorial.com
PDF
Tailoring Module 1 for shs tvl students.
PDF
MATH 7_WEEK 4_Properties on Operations of Integers and Converting Fractions t...
DOC
Curriculum standards commoncore_trainerguide
PPT
2. oop with c++ get 410 day 2
DOCX
PED 212 Enhance teaching - snaptutorial.com
PDF
Common Core Warm-Ups.pdf
DOCX
ISM3230 In-class lab 8 Spring 2019 TOPIC Introduction .docx
PPTX
Inheritance in c++
DOCX
FMM 325 Final Project Guidelines and Grading Guide Ov
Bashayer othman
Student Voice
Class as the Basis of all Computation.pptx
Advanced software engineering lab 2
Core java-course-content
Core java-course-content
Core java-training-course-content
E4
general mathematics.pdf
Root cause of community problem for this discussion, you will i
PED 212 Education Organization / snaptutorial.com
Tailoring Module 1 for shs tvl students.
MATH 7_WEEK 4_Properties on Operations of Integers and Converting Fractions t...
Curriculum standards commoncore_trainerguide
2. oop with c++ get 410 day 2
PED 212 Enhance teaching - snaptutorial.com
Common Core Warm-Ups.pdf
ISM3230 In-class lab 8 Spring 2019 TOPIC Introduction .docx
Inheritance in c++
FMM 325 Final Project Guidelines and Grading Guide Ov
Ad

More from piyushkumar979747 (7)

DOCX
Documentation of Electronics and Communication Engineeringe
PPTX
Electronics and Communication Enginnering
PPTX
Report of Electronics & Communication Engineering
PPTX
Electronic & Communication Engineering
PPTX
Electronic & Communication Engineering
PPTX
https://sviet.ac.in/b-tech-electrical-engineering/
PPTX
https://sviet.ac.in/b-tech-electrical-engineering/
Documentation of Electronics and Communication Engineeringe
Electronics and Communication Enginnering
Report of Electronics & Communication Engineering
Electronic & Communication Engineering
Electronic & Communication Engineering
https://sviet.ac.in/b-tech-electrical-engineering/
https://sviet.ac.in/b-tech-electrical-engineering/
Ad

Recently uploaded (20)

PDF
Model Code of Practice - Construction Work - 21102022 .pdf
PDF
Digital Logic Computer Design lecture notes
PPTX
Construction Project Organization Group 2.pptx
PPTX
Sustainable Sites - Green Building Construction
PPTX
Geodesy 1.pptx...............................................
PPTX
Internet of Things (IOT) - A guide to understanding
DOCX
573137875-Attendance-Management-System-original
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
PDF
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
PPTX
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
PDF
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
PDF
composite construction of structures.pdf
DOCX
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
PPTX
CH1 Production IntroductoryConcepts.pptx
PPTX
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
PPT
Mechanical Engineering MATERIALS Selection
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PDF
Operating System & Kernel Study Guide-1 - converted.pdf
PPTX
UNIT 4 Total Quality Management .pptx
PDF
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
Model Code of Practice - Construction Work - 21102022 .pdf
Digital Logic Computer Design lecture notes
Construction Project Organization Group 2.pptx
Sustainable Sites - Green Building Construction
Geodesy 1.pptx...............................................
Internet of Things (IOT) - A guide to understanding
573137875-Attendance-Management-System-original
CYBER-CRIMES AND SECURITY A guide to understanding
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
composite construction of structures.pdf
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
CH1 Production IntroductoryConcepts.pptx
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
Mechanical Engineering MATERIALS Selection
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
Operating System & Kernel Study Guide-1 - converted.pdf
UNIT 4 Total Quality Management .pptx
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks

Overview of ECE Engineer

  • 1. Second Part Q1. Create two classes named Mammals and MarineAnimals. Create another class named BlueWhale which inherits both the above classes. Now, create a function in each of these classes which prints "I am mammal", "I am a marine animal" and "I belong to both the categories: Mammals as well as Marine Animals" respectively. Now, create an object for each of the above class and try calling 1 - function of Mammals by the object of Mammal 2 - function of MarineAnimal by the object of MarineAnimal 3 - function of BlueWhale by the object of BlueWhale 4 - function of each of its parent by the object of BlueWhale OVERVIEW Mammals Marine Animals Base class Base class Blue Whale Derived class This class is inheriting the data and member of both ‘Mammals’ and ‘Marine Animals’ Multiple inheritance
  • 2. Multiple Inheritance:- In this type of inheritance there are more than one base class and only one derived class, Which inherits the property and methods of parents class. Now We have to declare function in each of the classes mammal, marineanimal and blue whale and do as the question says, And lastly declare the object of mammal, marineanimal and bluewhale and try calling function of each of its parent by the object of BlueWhale.
  • 3. Q2. Make a class named Fruit with a data member to calculate the number of fruits in a basket. Create two other class named Apples and Mangoes to calculate the number of apples and mangoes in the basket. Print the number of fruits of each type and the total number of fruits in the basket. OVERVIEW Fruit Apples Mangoes Base class Derived class Derived class Hierarchical inheritance Hierarchical inheritance Hierarchical inheritance:- In this type of inheritace there are single base class and multiple derived . i.e Both the derived class inherits the property and methods of single base class.
  • 4. Now Create data member according to questions. . . . . . And lastly create the object of derived class. Q3. We want to calculate the total marks of each student of a class in Physics ,Chemistry and Mathematics and the average marks of the class. The number of students in the class are entered by the user. Create a class named Marks with data members for roll number, name and marks. Create three other classes inheriting the Marks class, namely Physics, Chemistry and Mathematics, which are used to define marks in individual subject of each student. Roll number of each student will be generated automatically. OVERVIEW
  • 5. Marks physics chemistry mathematics Base class Derived class Derived class Derived class Hierarchical inheritance Hierarchical inheritance:- In this type of inheritace there are single base class and multiple derived . i.e Both the derived class inherits the property and methods of single base class. Now declare data member as the question says. Marks:- data members for roll number, name and marks.
  • 6. Q.4 We want to store the information of different vehicles. Create a class named Vehicle with two data member named mileage and price. Create its two subclasses *Car with data members to store ownership cost, warranty (by years), seating capacity and fuel type (diesel or petrol). *Bike with data members to store the number of cylinders, number of gears, cooling type(air, liquid or oil), wheel type(alloys or spokes) and fuel tank size(in inches) Make another two subclasses Audi and Ford of Car, each having a data member to store the model type. Next, make two subclasses Bajaj and TVS, each having a data member to store the make-type. Now, store and print the information of an Audi and a Ford car (i.e. model type, ownership cost, warranty, seating capacity, fuel type, mileage and price.) Do the same for a Bajaj and a TVS bike. Vehicle OVERVIEW CAR BIKE TVS BAJAJ FORD AUDI mileage and price. Hierarchical inheritance Hierarchical inheritance
  • 7. # Car with data members to store ownership cost, warranty (by years), seating capacity and fuel type (diesel or petrol). . #Bike with data members to store the number of cylinders, number of gears, cooling type(air, liquid or oil), wheel type(alloys or spokes) and fuel tank size(in inches). #Make another two subclasses Audi and Ford of Car, each having a data member to store the model type. Next, make two subclasses Bajaj and TVS, each having a data member to store the make-type. 5. Create a class named Shape with a function that prints "This is a shape". Create another class named Polygon inheriting the Shape class with the same function that prints "Polygon is a shape". Create two other classes named Rectangle and Triangle having the same function which prints "Rectangle is a polygon" and "Triangle is a polygon" respectively. Again, make another class named Square having the same function which prints "Square is a rectangle". Now, try calling the function by the object of each of these classes. OVERVIEW Shape polygons Rectangle Triangle polygons HYBRID INHERITANCE  HYBRID INHERITANCE:-It is the combination of multiple and multilevel inheritance . Means two child class inherits the property and method of parent class. And then a another child class inherit the property of previous two child class.
  • 8. Q.6 All the banks operating in India are controlled by RBI. RBI has set a well defined guideline (e.g. minimum interest rate, minimum balance allowed, maximum withdrawal limit etc) which all banks must follow. For example, suppose RBI has set minimum interest rate applicable to a saving bank account to be 4% annually; however, banks are free to use 4% interest rate or to set any rates above it. Write a program to implement bank functionality in the above scenario. Note: Create few classes namely Customer, Account, RBI (Base Class) and few derived classes (SBI, ICICI, PNB etc). Assume and implement required member variables and functions in each class RBI OVERVIEW SBI ICICI PNB Hierarchical inheritance RBI Declare variable minimum interest rate, minimum balance allowed, maximum withdrawal limit And declare function to define this variable.