Waiting for answer This question has not been answered yet. You can hire a professional tutor to get the answer.

QUESTION

In this assignment you will be creating 4 classes Loan, Client, Accountant, and Bank along with a single function called create banks from file. 1.1 LoanThe Loan class takes in 3 arguments principal,

In this assignment you will be creating 4 classes Loan, Client, Accountant, and Bank along with a single function called create banks from file. 

1.1 Loan

The Loan class takes in 3 arguments principal, rate, and time each of which will be floats or ints. Each argument needs to become an instance variable named self.principal, self.rate, and self.time. You need to implement 3 methods.

1.1.1 calculate monthly payment 

The basic idea of the Loan class is that it can calculate some information regarding loans. calculate monthly payment calculates the amount one needs to pay per month to pay back the loan in the correct amount of time. The total amount borrowed money is the principal, the number of payments is time and the interest rate per month is rate. In order to calculate the total cost per month you need to use the equation 6. If you are interested or confused, you can see where I got the equation and a deeper explanation here P = principal (1) r = rate (2) t = time (3) A = cost per month (4) (5) A = P r(1 + r) t (1 + r) t − 1 (6)

1.1.2 calculate total owed 

calculate total owed needs to calculate the total amount of the loan which needs to be paid. This is the time multiplied by the cost per month.

1.1.3 calculate total interest 

calculate total interest needs to calculate the total amount of interest which will be paid. This is the total owed minus the principal

1.2 Client 

The Client class takes in 4 arguments name, total savings, total checking, and loan. name will be a string and both total savings and total checking will be floats or ints. loan is supposed to be an instantiated Loan object. You need to implement 5 methods.

1.2.1 total in checking 

Return total checking.

1.2.2 total in savings 

Return total savings

1.2.3 total borrowed

Return the amount of money borrowed. This can be found out through the Loan object passed in via loan.

1.2.4 total interest

Return the amount of interest owed. This can be found out through the Loan object passed in via loan.

1.2.5 total owed

Return total amount of money owed. This can be found out through the Loan object passed in via loan.

1.3 Accountant

The Accountant class takes in 1 argument, name (a string). You need to implement 5 methods.

1.3.1 add client

This method takes in a Client object and adds it to self.clients. It does not need to return anything

1.3.2 get client

This method takes in a name and searches for the client in self.clients. If the client exists, return the client otherwise return None.

1.3.3 get number of clients

This method returns the number of clients this Accountant has

1.3.4 total in checking

Returns the sum total amount in all the clients’ checking accounts.

1.3.5 total in savings

Returns the sum total amount in all the clients’ savings accounts.

1.3.6 total loaned out

Returns the sum total amount loaned out to the clients.

1.3.7 calculate total profit

Returns the sum total amount of interest that the clients have to pay. This is considered ”profit” since the bank makes money off of loans by collecting interest.

1.4 Bank

The Bank class takes in 1 argument, name (a string). You need to implement 8 methods.

1.4.1 add accountant 

This method takes in an Accountant object and adds it to self.accountants. It does not need to return anything 

1.4.2 get accountants 

This method takes in a name and searches for the client in self.accountant. If the accountant exists, return the accountant otherwise return None. 

1.4.3 get number of accountants 

This method returns the number of accountants this Bank has. 

1.4.4 total in checking 

Returns the sum total amount in all the accountants’ clients’ checking accounts

1.4.5 total in savings 

Returns the sum total amount in all the accountants’ clients’ savings accounts. 1.4.6 total loaned out 

Returns the sum total amount loaned out to all accountants’ clients.

1.4.7 calculate total profit 

Returns the sum total amount of interest that the accountants’ clients have to pay. 1.5 create banks from file 

create banks from file is a stand alone function which will be parsing a csv (comma-separated values) file and converting the data in the csv file into Bank, Accountant, Client and Loan classes you just created. You will be given two test csv files [banking statement.csv, banking statement2.csv]. Each of these files contains a header and some data.

banking statement.csv: Bank,Accountant,Client,Savings,Checking,Principal,Rate,Time boa,acct1,client1,1000,2000,100,0.1,10 

boa,acct1,client2,1000,2000,100,0.1,20

banking statement2.csv: Bank,Accountant,Client,Savings,Checking,Principal,Rate,Time boa,acct1,client1,1000,2000,100,0.1,10 

chase,acct1,client3,1000,2000,0,0,0 

boa,acct2,client2,1000,2000,20,0.1,10 

chase,acct1,client1,1000,2000,0,0,0 

boa,acct2,client3,1000,2000,10,0.1,20 

chase,acct1,client2,1000,2000,0,0,0

If we look at the first file, banking statement.csv, you can see that this function will create two Loans, one for each Client. Both clients are with a single Accountant which works for a single Bank. Therefore, you will return a list of length 1 with a single Bank object. You can assume that each line has a unique combination of bank, accountant, and client so there are no rows with the same client, accountant and bank. However, that does not mean the names can be reused in other orderings as you can see from banking statement2.csv. IMPORTANT NOTE!: The main function has almost all tests you need to pass. Once you put the correct paths to banking statement.csv and banking statement2.csv in the main, do not change it! You should work on getting each assert statement to pass. If you can run the main and there are no errors you are guaranteed an A.

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question