/Scala_Tutorial_09

Functional Programming using Scala Tutorial 9

Primary LanguageScala

Scala_Tutorial_09

Functional Programming using Scala Tutorial 9

    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 xy-z where x=3/4, y=5/8, z=2/7.
  2. Implement a Data Structure for Account and create a method transfer which transfers the money from this account to a given account. Basic functions: Deposit, Withdraw, Transfer
  3. A Bank is defined as a 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 applying the interest function as follows: If balance is positive, deposit interest is .05 and if balance is negative, overdraft interest is .1