Create a class hierarchy to represent a set of animals. Include properties and methods that are common to all animals, as well as properties and methods that are specific to different kinds of animals (e.g. birds, mammals, fish, etc.).
Write a program to simulate a library. Create classes to represent books, borrowers, and librarians. Implement methods to check out, check in, and reserve books.
Implement a simple card game using object-oriented programming principles. Create classes to represent the deck of cards, players, and the game itself. Implement methods to shuffle and deal the cards, as well as to check for winning hands.
Design and implement a program to model a restaurant. Create classes to represent customers, tables, waiters, and the kitchen. Implement methods to take orders, prepare and serve food, and handle payment.
Create a class hierarchy to represent different shapes (e.g. circles, rectangles, triangles, etc.). Implement methods to calculate the area, perimeter, and other properties of each shape.
Create a class hierarchy to represent a zoo. The hierarchy should have a base class for animals, and sub-classes for different types of animals, such as mammals, birds, and reptiles.
Implement a simple banking system using Object-Oriented Programming. The system should include classes for accounts, customers, and transactions.
Create a class to represent a vehicle, and sub-classes for specific types of vehicles, such as cars, trucks, and motorcycles. The classes should include properties such as make, model, and year, as well as methods for accelerating and braking.
Develop a class hierarchy to represent a game, such as a card game or board game. The hierarchy should include base classes for players and the game itself, as well as sub-classes for specific types of games.
Build a class to represent a bank account, including properties such as balance, interest rate, and account number. Add methods for depositing, withdrawing, and calculating interest.
Design a class hierarchy to represent a university system, including classes for students, professors, courses, and departments.
Implement a library system using Object-Oriented Programming. The system should include classes for books, patrons, and transactions.
Create a class to represent a shopping cart, including methods for adding and removing items, as well as calculating the total cost.
Build a class hierarchy to represent a video game, including base classes for the game and players, and sub-classes for specific game genres.
Develop a class to represent a musical instrument, and sub-classes for specific types of instruments, such as guitars, pianos, and drums. The classes should include properties such as brand, model, and price, as well as methods for playing the instrument.
Some exercises for a simple banking system using Object-Oriented Programming:
Design a BankAccount class with attributes such as account number, account holder name, account type, balance, and interest rate. Include methods such as deposit, withdraw, calculate interest, and display account details.
Create a SavingsAccount class that inherits from BankAccount and includes additional attributes such as minimum balance and interest rate. Override the calculate interest method to apply the correct interest rate for a savings account.
Create a CheckingAccount class that also inherits from BankAccount and includes additional attributes such as overdraft limit and transaction fees. Override the withdraw method to prevent overdrafts and apply transaction fees.
Create a Bank class that manages a collection of BankAccount objects. Include methods such as add account, remove account, search account, and display all accounts.
Create a Transaction class that includes attributes such as transaction type, transaction amount, transaction date, and account number. Include methods to record transactions for a specific account and display all transactions for an account.
Implement a LoanAccount class that also inherits from BankAccount and includes additional attributes such as loan amount, interest rate, and repayment period. Include methods to calculate monthly payments and display the outstanding loan balance.
Create a Customer class that includes attributes such as customer name, address, phone number, and a collection of accounts. Include methods to add accounts, remove accounts, and display account information for a customer.
Implement a BankManager class that manages a collection of customers and their accounts. Include methods to add customers, remove customers, search for customers, and display all customers and their accounts.
Create an ATM class that allows customers to withdraw money, deposit money, and check their account balance. Include methods to validate account numbers and PINs.
Implement a Transfer class that allows customers to transfer money between their own accounts or to other customers' accounts. Include methods to validate account numbers and transfer amounts.
Không có nhận xét nào