Lasan-180 / Functions_and_Data

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Functions_and_Data

  1. Implement a Data Structure for Rational Number and create a method neg to class Rational that is used like this:

x.neg // evaluates to -x

  1. Create a method sub to subtract two rational numbers and find an answer x-y-z where x=3/4, y=5/8, z=2/7.

  2. Implement a Data Structure for Account and create a method transfer which transfer the money from this account to a given account.

  3. A Bank defines as List of Accounts. So implement the following functions:

4.1 List of Accounts with negative balances

4.2 Calculate the sum of all account balances

4.3 Calculate the final balances of all accounts after apply the interest function as fallows:

If balance is positive, deposit interest is .05 and if balance is negative, overdraft interest is .1

You answers should be uploaded to your repository.

Post the URL of your repository to the LMS.

About


Languages

Language:Scala 100.0%