Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

IT 209 Bi-Weekly Assignment #1 Due: 2/21/2020, 11:59PM Topics: class, object, instantiation, methods 1. Problem Statement: In this lab, you will design a simple bank

image text in transcribedimage text in transcribedimage text in transcribed

IT 209 Bi-Weekly Assignment #1 Due: 2/21/2020, 11:59PM Topics: class, object, instantiation, methods 1. Problem Statement: In this lab, you will design a simple bank account class that can perform basic banking operations on an account. The purpose of this lab is to exercise python's basic OOP techniques: class, object, instances and methods. Helpful codes can be found in the lecture 3 and 4. Attributes and Methods: ID Attributes Description Data type Type of attribute/varibale First name First name associated with an string instance attribute account Last name Last name associated with an string instance attribute account Balance Current balance of an account Float instance attribute object. This is a private attribute. Account ID, randomly generated String instance attribute by the program. This is a private attribute. Each ID will be unique and it's a 2 length alphanumeric string. For example: k7, A9 etc. See below** Total number of keeps track of the total number integer class attribute of accounts in the bank ** you can use string module to generate random number and alphabets. String module has string.digits that contains all the digits and string.ascii_letters returns all the letters. You need to choose one letter and one digit randomly and generate the ID. Method name init () Return type parameter First name, last name, initial balance. Description This is a constructor method. This method will initialize an account's first name, last name, initial balance and a randomly generated ID. See above for details of attributes. This method will also update the total number of accounts class variable. Returns the full name of a person. Returns the ID of an account Generates a random ID as described above **. This is a private method. none get_full_name() get ID) _generate_ID() none string string string none get_balance() Returns the current balance. none float _validate_amount() amount True if amount is valid False otherwise deposit() none Amount to deposit withdraw() none Amount to withdraw Checks if an amount is valid. If current balance is higher than the amount than it is valid. withdraw() and transfer() methods use this method to check for amount validity. Adds amount to deposit to current balance. Displays the current balance after the operation. Withdraws amount from the current balance. Checks if amount to withdraw is valid. If amount to withdraw is not valid display an error message. Otherwise, display the current balance Transfers some amount from other account object to current object. Checks if amount to transfer is valid in other account object. If amount is not valid display an error message. Otherwise, display the current balance after transfer String representation of an account object. Returns a welcome message along with some information: name, ID and current balance (see sample 1/0) transfer none Other account object (from_account), amount to transfer -_str_0 none | string Object Creation: You need to create at least three objects (al, a2 and a 3) passing required parameters: first name, last name and initial balance. Sample information of the objects as follows: Object First name Last name Initial balance al Donald Duck 10000 a2 Jane Doe 100 a3 Jack thePlumber 900 Print each object using standard print method. - Test the following scenarios where your program will succeed: o Make a deposit of $100 to al o Make a withdraw $10 to a2 o Transfer $200 from alto a3 o Print the number of accounts created Test the following scenarios that we expect will FAIL - for these you will want to catch the exception and print the exception, so that you see the error message, and that rest of your Print each object using standard print method. - Test the following scenarios where your program will succeed: o Make a deposit of $100 to al o Make a withdraw $10 to a2 o Transfer $200 from alto a3 o Print the number of accounts created Test the following scenarios that we expect will FAIL - for these you will want to catch the exception and print the exception, so that you see the error message, and that rest of your code continue to run. o Withdraw $1000 from account a2 o Transfer $900 from a 2 to al For all of these, make sure the code is printing some informational messages (see sample 1/0). Sample I/O: (user input shown in black): ********* Welcome Donald Duck account ID: a1 Your current balance is: 10000 Welcome Jane Doe account ID: 54 Your current balance is: 100 Welcome Jack thePlumber account ID: al Your current balance is: 900 Your current balance is: 10100 Your current balance is: 90 Your current balance is: 1100 Invalid Withdrawal. Insufficient Fund. Invalid Transfer. Insufficient Fund in Sender Account Total number of accounts: 3

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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

Focus On Geodatabases In ArcGIS Pro

Authors: David W. Allen

1st Edition

1589484452, 978-1589484450

More Books

Students also viewed these Databases questions

Question

Give a basic definition of natural law theory.

Answered: 1 week ago

Question

=+1.2. Show that N and N are dense [A15] in (0, 1].

Answered: 1 week ago

Question

9. Describe the characteristics of power.

Answered: 1 week ago

Question

3. Identify and describe nine cultural value orientations.

Answered: 1 week ago