Question: Python Checking Account Class. Write a class named CheckingAccount that contains the current balance of the account (an int) and the following methods: init -

 Python Checking Account Class. Write a class named CheckingAccount that contains

Python Checking Account Class. Write a class named CheckingAccount that contains the current balance of the account (an int) and the following methods:

  • init - takes a balance parameter to initialize the data (balance)of the object.
  • withdraw - takes an input parameter amount and modifies the data by reducing the balance. If amount results in an overdraw, subtract an extra 20 dollars. This method should return the balance.
  • deposit - takes an input parameter amount and modifies the data by increasing the balance by amount.

Write a few test cases to check your work.

Exercise 7 Write a class named "CheckingAccount that contains the currentbalanceof the account (an int) and the following methods: init - takes a "balance" parameter to initialize the data (balance)of the object. withdraw - takes an input parameter "amount" and modifies thedata by reducing the balance. If "amount" results in an overdraw, subtract an extra 20 dollars. This method should return the balancebalance. deposit - takes an input parameter "amount" and modifies the databy increasing the balance by "amount". Write a few test cases to check your work In [1]: ## Write your class here In [ ]: ## Test your class here

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!