Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

done #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions ATM.js
Original file line number Diff line number Diff line change
@@ -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;

}
}