From a9481a04d29c53132231531d18f37f64f349f2e1 Mon Sep 17 00:00:00 2001 From: Mhammad1704 Date: Wed, 6 Feb 2019 11:07:11 +0300 Subject: [PATCH] done --- ATM.js | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 ATM.js diff --git a/ATM.js b/ATM.js new file mode 100644 index 0000000..2449e11 --- /dev/null +++ b/ATM.js @@ -0,0 +1,61 @@ +// ===================== this code is writtin by me ====================== + +class ATM { + constructor(type,money) { + this.type = type ; + this.money = 0 ; + + } + + withdraw () { + this.money = this.money - 50; + console.log(this.money); + } + + deposit (){ + this.money = this.money + 100; + console.log(this.money); + } + + showBalance (){ + 'your Balance is ' + this.money; + } +} + + + let user1 = new ATM(); + user1.deposit(); + user1.deposit(); + user1.deposit(); +user1.showBalance(); + console.log(user1); + + +//============================= the next code is with help of my frind Abdulmohsin Sharhan ============ + +class ATM { + constructor(type) { + this.type = type ; + this.money = 0 ; + this.transactionHistory= ''; + } + + withdraw (num) { // add amount auttrebut withdraw(amount){ this.monyey = this.money - this.amount ; + this.money = this.money - num; + this.transactionHistory += 'Toy are withdrow by '+num; + } + + deposit (num){ + this.money = this.money + num; + this.transactionHistory += 'Toy are deposit by '+num + } + + showBalance (){ + return 'your Balance is ' + this.money; + } + transactionHistory(){ +return this.transactionHistory; + + } + } + \ No newline at end of file