-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.ts
55 lines (43 loc) · 1.35 KB
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#! /usr/bin/cnv node
import inquirer from "inquirer"
let balance = 10000
let pin = 1234
let accountPin = await inquirer.prompt([
{
name : "myPin",
message : "Please enter your password",
type : "number",
}
])
if (accountPin.myPin === pin){
console.log("You entered correct password.")
let operation = await inquirer.prompt([
{
name: "option",
type: "list",
message: "Please select option",
choices: ["withdraw", "Cheak Balance",],
}
])
if(operation.option === "withdraw"){
let amount = await inquirer.prompt([
{
name : "ammountt",
type: "number",
message: "Enter ammount what you want to withdraw.",
}
])
if(amount.ammountt <= balance){
let remainbalance = balance - amount.ammountt
console.log(`You have successfuly withdraw ${amount.ammountt}`)
console.log(`Your remaining balance is ${remainbalance}`)
}
else if(amount.ammountt > balance){
console.log("Insufficient Balance");
}
}
else if(operation.option === "Cheak Balance"){
console.log(`Your balance is ${balance}`)
}
}else {console.log("You enter incorrect password!");
}