Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program that defines a BankAccount class and uses the class to create and update a bank account object. The program will prompt the

Write a program that defines a BankAccount class and uses the class to create and update a bank account object. The program will prompt the user to enter details about the bank account (account holder, account number, account type, and account balance). The program will use the information entered to create a BankAccount object. Once the account is created the program display the bank account details, updates some of the account properties and displays the updated account.

Part 1:

Define a class, BankAccount, a Python module named bank_account.py. The class will contain the following:
 

1. Instance variables for the account number, account holder, account type, and account balance

a. Account number will store a 10-digit integer value representing the account number

b. Account holder/owner will store the first and last name of the account owner

c. Account type will hold a value of Checking or Savings

d. Account balance will store a floating-point value representing the balance

 

2. Constructor (__init__) that takes four parameters representing the account number, account holder/owner, account type, and account balance. The constructor will use the parameters passed in to set the value of each instance variables

3. Add Set and get properties for each of the instance variables

Requirements:

1. Create a python module, bank_account.py

2. Create class, BankAccount, definition

a. Add constructor with correct number of parameters

i. Set instance variables to the values of the parameters passed in

b. Create set property for each instance variable

i. Include the correct logic to update the instance variable value

c. Create get property for each instance

i. Include the correct logic to get the instance variable value

Part 2:

Write a client module, bank_client.py, that prompts the user for a bank account details. The program will perform the following actions:

1. Prompt the user to enter the bank account owner, bank account number, bank account balance, and bank account type

2. Create an object of BankAccount using the information entered

3. Display the bank account details (account owner, account number, account balance, account type)

4. Update the account object

a. Update the account owner by setting the account holder/owner to a value other than what the user entered

b. Update the account balance by setting the account balance to a value other than what the user entered

5. Display the updated bank account details (account owner, account number, account balance, account type)

Requirements:

1. Import the bank_account module.

2. Prompt the user to enter the bank account details.

3. Create an object of BankAccount using values entered by the user

4. Display the bank account details

5. Update the bank account owner and balance

6. Display the updated account details

Program Example

Enter Account number: 1234567891

Enter Account Owner: John Doe

Enter Account Type: Checking

Enter Account balance: 1000


Account Number: 1234567891

Account Owner: John Doe Account Type: Checking

Account Balance: 1000.0

Updated account details:

Account Number: 1234567891

Account Owner: John Doe Account Type: Checking

Account Balance: 2000.0

Step by Step Solution

There are 3 Steps involved in it

Step: 1

Python program with two modules bankaccountpy containing the BankAccount class and bankclientpy the client module that implements the described functi... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Java Programming

Authors: Joyce Farrell

9th edition

1337397075, 978-1337397070

More Books

Students also viewed these Programming questions