Question: For all problems you must: Write a Python ( .py ) program Test, debug, and execute the Python program Submit a copy of your commented
For all problems you must:
- Write a Python (.py) program
- Test, debug, and execute the Python program
- Submit a copy of your commented source code on-line
- (11 pts.) Create a Person class that contains the following members: name, email, and phone_number Provide a constuctor that initializes all three members with data passed to the constructor. Add a __str__ method that returns a string printing the data members. Provide methods that allows you to get and set all three data members. Demonstrate the correctness of your program with a couple sample test cases.
- (11 pts.) Create an Account class that contains the following members: Person, account_number and balance where composition is used for the Person data member. Provide a constuctor that initializes all three members with the data passed to the constructor. Provide a method that allows you to get the account_number and methods that allow you to get and set the Person and balance data members. Additionally, for this class any attempt in a method or constructor to set a negative balance should result in the balance being set to 0. (Note: You must use composition for the Person data member). Demonstrate the correctness of your program with a couple sample test cases.
- (11 pts.) Create a Savings_Account class that is a derived class of the Account class. Add a minimum_balance data member and deposit and withdrawl methods. The class should contain a constructor method that utilize the Account constructor but also ensures that no object is created if the provided balance is less than the provided minimum_balance. A __str__ method that displays all data members should also be provided. Additionally, any call to the withdrawl method should fail if the balance would drop below the minimum_balance. Demonstrate the correctness of your program with a couple sample test cases.
- (11 pts.) Create a Loan_Account class that is a derived class of the Account class. Add a maximum_balance data member and deposit and withdrawl methods. The class should contain a constructor method that utilize the Account constructor but also ensures that no object is created if the provided balance is greater than the provided maximum_balance. A __str__ method that displays all data members should also be provided. Additionally, any call to the withdrawl method should fail if the balance would exceed the maximum_balance and any call to deposit should fail if he balance would drop below 0. Demonstrate the correctness of your program with acouple sample test cases.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
