Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions 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
Check Mark
Knowledge Booster
Background pattern image
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
    Text book image
    Database System Concepts
    Computer Science
    ISBN:9780078022159
    Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
    Publisher:McGraw-Hill Education
    Text book image
    Starting Out with Python (4th Edition)
    Computer Science
    ISBN:9780134444321
    Author:Tony Gaddis
    Publisher:PEARSON
    Text book image
    Digital Fundamentals (11th Edition)
    Computer Science
    ISBN:9780132737968
    Author:Thomas L. Floyd
    Publisher:PEARSON
    Text book image
    C How to Program (8th Edition)
    Computer Science
    ISBN:9780133976892
    Author:Paul J. Deitel, Harvey Deitel
    Publisher:PEARSON
    Text book image
    Database Systems: Design, Implementation, & Manag...
    Computer Science
    ISBN:9781337627900
    Author:Carlos Coronel, Steven Morris
    Publisher:Cengage Learning
    Text book image
    Programmable Logic Controllers
    Computer Science
    ISBN:9780073373843
    Author:Frank D. Petruzella
    Publisher:McGraw-Hill Education