



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




Create a class named BankAccount. The class should have private fields for: id: int balance: decimal The class should also have public properties for: Id: int Balance: decimal You should be able to use the class like this:
Create a new class and ensure proper naming
Create a class BankAccount (you can use class from previous task) The class should have private fields for: id: int balance: decimal The class should also have properties for: Id: int Balance: decimal Deposit(decimal amount): void Withdraw(decimal amount): void Override the method ToString(). You should be able to use the class like this:
Create a method Deposit(decimal amount) Create a method Withdraw(decimal amount) Override the method ToString() Problem 3. Test Client Create a test client that tests your BankAccount class. Support the following commands : Create {Id} Deposit {Id} {amount} Withdraw {Id} {amount} Print {Id} End If you try to create an account with an existing Id, print "Account already exists". If you try to perform an operation on a non-existing account , print "Account does not exist". If you try to withdraw an amount larger than the balance, print "Insufficient balance". The Print command should print "Account ID{id}, balance {balance}". Round the balance to the second digit after the decimal separator.
Implement the rest of the commands following the same logic. Problem 4. Person Class Create a Person class. The class should have private fields for: name: string age: int accounts: List
Create the class as usual: Create a constructor with two parameters: Create a constructor with three parameters:
Create method GetBalance() : Optional: You can take advantage of constructor chaining :