create a class in python with a constructor To create instances of the user defined class and practice applying them. Practice implementing loops.   Part 1 Instructions: Create a class called BankAccount  with the following variables: balance name account_id Create 1 constructor  for the class BankAccount (with or without parameters, your choice, but only 1): def __init_(self, name, account_id, balance) def __init_(self) Create the following methods in the BankAccount class: def viewAccountInfo() //prints all account information def withdraw(self, amount) //withdraws from the balance def deposit(self, amount) //deposits to the balance Your task after your class has been created: Create two objects,  "personal" and  "joint_account" with initial balances of: personal =  $1000 joint_account = $3000 Use the constructor to create the objects.  Create a program that prompts the user which account they would like to access personal or joint Which account would you like to access?  1. Personal 2. Joint Account 3. Exitonce they select an account, display all account information using the method ViewAccountInfo(). This menu should repeat, the user should be able to select either personal or joint and then be able to select again once they are done with that account.  Next show the following menu: What would you like to do next: 1. Deposit 2. Withdraw 3. View Balance 4. Update account holder 5. Exit Do not let them withdraw more than what is in the account, if they attempt, output "Error, Insufficient funds".  Once the user has finished depositing or withdrawing to their account, output their old balance, and the new balance.

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter9: Using Classes And Objects
Section: Chapter Questions
Problem 1CP: In previous chapters, you have created programs for the Greenville Idol competition. Now create a...
icon
Related questions
Question

 create a class in python with a constructor To create instances of the user defined class and practice applying them. Practice implementing loops.

 

Part 1 Instructions:
Create a class called BankAccount  with the following variables:

balance
name
account_id


Create 1 constructor  for the class BankAccount (with or without parameters, your choice, but only 1):


def __init_(self, name, account_id, balance)
def __init_(self)


Create the following methods in the BankAccount class:

def viewAccountInfo() //prints all account information def withdraw(self, amount) //withdraws from the balance def deposit(self, amount) //deposits to the balance


Your task after your class has been created:

  1. Create two objects,  "personal" and  "joint_account"
    with initial balances of:
    personal =  $1000
    joint_account = $3000


    Use the constructor to create the objects.


  2.  Create a program that prompts the user which account they would like to access personal or joint

    Which account would you like to access? 
    1. Personal
    2. Joint Account
    3. Exitonce they select an account, display all account information using the method ViewAccountInfo().
    This menu should repeat, the user should be able to select either personal or joint and then be able to select again once they are done with that account. 


  3. Next show the following menu:
    What would you like to do next:
    1. Deposit
    2. Withdraw
    3. View Balance
    4. Update account holder
    5. Exit

    Do not let them withdraw more than what is in the account, if they attempt, output "Error, Insufficient funds".  Once the user has finished depositing or withdrawing to their account, output their old balance, and the new balance. 


 Part 2 Instructions accessors and mutators
Make all your class variables private. 
Do not allow any of the class variables to be modified without a setter (mutator). 
For the balance setter, do not allow any values of 0 or lower. 
Do not allow account_id to be modified, you can do this by omitting the setter for account_id, or adding some type of error code if they do try. 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Software Development
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT