Giter Site home page Giter Site logo

bankaccount's Introduction

BankAccount

IOS assignment#1 exercise5

Exercise 5: [10 marks]

Do the following using Xcode project: Create a class BankAccount (store it in a separate file - BankAccount.swift) which is having the following:

  • Account number, customer name, yearly interest rate, account balance as stored properties
  • Account balance should not be negative and there should be minimum 10.00 dollars all the time.
  • and interest rate should be positive and between 0.0 and 2.0 %
  • You need to define property observers - didSet for all the properties
  • Define a description as computed property which display all the values of bank account object
  • Define two initializers, one which initializes all the properties to their default values and one which initializes to appropriate values
  • Define two functions- one is credit(amount:Double) which is used for depositing money and second which is debit(amount:Double) which is used for withdrawing money.

Create an extension to BankAccount class (store it in separate file - BankAccountExtension.swift) and define the following in there:

  • Interest should be defined as computed property which is calculated by using interest rate formula
  • One convenience initializer which initializes (provides values for) account number, name and balance.
  • Add a deinitializer also

Test the above class in main.swift file by creating at least two objects of bank account class and test the capabilities of the class.

bankaccount's People

Contributors

dhruvinparikh avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.