0% found this document useful (0 votes)
7 views

Assignment - 1- Object-Oriented Programming in Python

The document outlines an assignment focused on Object-Oriented Programming in Python, requiring the creation of various classes such as Rectangle, Student, Person, Animal, and BankAccount. Each task includes specific attributes and methods to implement, along with instructions to document the code and results in a Word file. Students must include their name and roll number at the top of the document for evaluation purposes.

Uploaded by

awesome.abhi83
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

Assignment - 1- Object-Oriented Programming in Python

The document outlines an assignment focused on Object-Oriented Programming in Python, requiring the creation of various classes such as Rectangle, Student, Person, Animal, and BankAccount. Each task includes specific attributes and methods to implement, along with instructions to document the code and results in a Word file. Students must include their name and roll number at the top of the document for evaluation purposes.

Uploaded by

awesome.abhi83
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Assignment - 1: Object-Oriented Programming in Python

Instructions:
● Prepare a document in a Word file.
● On the first page or at the top of the document, write your full name and
roll number (Otherwise, the file will not be considered for evaluation).
● In the document, write the code for the given question, and add a
screenshot of the result. (Repeat the same for all questions provided in the
assignment.)

Tasks:
1. Write a Python program that defines a class called Rectangle. The class
should have attributes length and width, and methods to calculate the area
and perimeter of the rectangle.

2. Create a class called Student with attributes name, age, and grade.
Implement a method to display the student's information. Create an object of
the class and display the information.

3. Write a Python program to create a person class. Include attributes like


name, country and date of birth. Implement a method to determine the
person’s age.

4. Write a Python program that demonstrates inheritance. Create a base class


called Animal with a method speak(). Derive two classes, Dog and Cat, from
the base class. Override the speak() method in each derived class to make
the dog bark and the cat meow. Create objects of both derived classes and
call their speak() methods.

5. Implement a class called BankAccount with attributes account_number,


account_holder, and balance. Include methods to deposit and withdraw
money. Ensure that the withdrawal amount does not exceed the available
balance. Create an object of the class, perform some transactions, and
display the updated balance.

You might also like