0% found this document useful (0 votes)
2 views1 page

Abc Sheet

Uploaded by

norantharwat58
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views1 page

Abc Sheet

Uploaded by

norantharwat58
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Sheet

Exercise 1: Animal Abstraction

1. Create an abstract class Animal with abstract methods make_sound() and eat().

2. Create concrete subclasses Dog, Cat, and Bird that inherit from Animal.

3. Implement the abstract methods in the subclasses to represent the specific sounds and
eating habits of each animal.

Exercise 2: Vehicle Abstraction

1. Create an abstract class Vehicle with abstract methods start(), stop(), and move().

2. Create concrete subclasses Car, Motorcycle, and Bicycle that inherit from Vehicle.

3. Implement the abstract methods in the subclasses to represent the specific actions of each
vehicle.

Exercise 3: Geometric Shape Abstraction

1. Create an abstract class Shape with abstract methods area() and perimeter().

2. Create concrete subclasses Circle, Rectangle, and Triangle that inherit from Shape.

3. Implement the abstract methods in the subclasses to calculate the area and perimeter of
each shape.

Exercise 4: File Operation Abstraction

1. Create an abstract class FileOperation with abstract methods open_file(), read_file(),


write_file(), and close_file().

2. Create concrete subclasses TextFile and BinaryFile that inherit from FileOperation.

3. Implement the abstract methods in the subclasses to perform file operations on text and
binary files.

Exercise 5: Database Abstraction

1. Create an abstract class Database with abstract methods connect(), query(), and close().

2. Create concrete subclasses MySQLDatabase and PostgreSQLDatabase that inherit from


Database.

3. Implement the abstract methods in the subclasses to connect to and interact with MySQL
and PostgreSQL databases.

You might also like