Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Question 1: Python Design a class named Account that contains: A private int dat

ID: 3766109 • Letter: Q

Question

Question 1: Python  

Design a class named Account that contains:

A private int data field named id for the account.

A private int data field called pin for the account.

A private float data field named chequingBalance for the account.

A private float data field named savingBalance for the account.

A private float data field named annualInterestRate that stores the current interest rate.

A constructor ( __init__ ) that creates an account with the specified id (default 0), pin (default= 1234), chequingbalance (default 100), savingbalance (default 0) and annual interest rate (default 0).

The accessor and mutator methods (set and get) for id, pin, chequingbalance, savingbalance, and annualInterestRate. (With data validation)

A method named getMonthlyInterestRate() that returns the monthly interest rate.

A method named getMonthlyInterest() that calculates and returns the monthly interest (It should also update the savingbalance).

A method named WithdrawChequing that withdraws a specified amount from the account. (The function should check if there is sufficient funds to do the operation. It should update the chequingbalance accordingly)

A method named DepositChequing that deposits a specified amount to the account (It should update the chequingbalance).

A method named WithdrawSaving that withdraws a specified amount from the account. (The function should check if there is sufficient funds to do the operation. It should update the savingbalance accordingly)

A method named DepositSaving that deposits a specified amount to the account (It should update the savingbalance).

A method named Transfer that transfer a specified amount from one account to another (chequing to saving or the opposite and it should update both balances. It should also check if sufficient funds are available).

Draw and submit the UML diagram for the class with your code for the account class and then implement the class.

Hints:

Use this formula to calculate the monthly interest:

savingbalance * monthlyInterestRate.

Where monthlyInterestRate is annualInterestRate / 12.

Note that annualInterestRate is a percent (like 4.5%). You need to divide it by 100.

Write a test program that creates an Account object with an account id of 1122, a pin of 4545 a chequing balance of $20,000, a saving balance of $25,000 and an annual interest rate of 4.5%. Use the withdraw method to withdraw $2,500 from the chequing account, and print the id and balance, use the deposit method to deposit $3,000 to the saving account, and print the id, balance, monthly interest rate, and monthly interest. Transfer $5,000 from saving to chequing account.

I'm not too sure where to even start with this, any help would be great.

Explanation / Answer

class Account: def __init__(self): self.balance=balance def getMonthlyInterestRate(self): return (annualInterest/100) def getMonthlyInterest(self): return blanace * monthlyInterestRate from Account import Account def main(): account = Account() account.getMonthlyInterestRate(4.5) print("Beginning Balance: ", account.balance) print("Monthly Interest Rate: ", account.getMonthlyInterestRate) print("Monthly Interest: ", account.getMonthlyInterest) main()

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote