-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
37 lines (37 loc) · 1.03 KB
/
app.js
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
import inquirer from "inquirer";
let myBalance = 10000; // Dollar
let myPin = 2914;
const pinAnswer = await inquirer.prompt([{
name: "PIN",
message: "Enter your PIN",
type: "number"
}]);
if (pinAnswer.PIN === myPin) {
console.log("Correct PIN code!!!");
let operationAns = await inquirer.prompt([
{
name: "operation",
message: "please! select option",
type: "list",
choice: ["withDraw", "checkBalance"]
}
]);
console.log(operationAns);
if (operationAns.operation === "withDraw") {
let amountAns = await inquirer.prompt([
{
name: "amount",
message: "Enter your amount",
type: "number"
}
]);
myBalance -= amountAns.amount;
console.log("Your remaining balance is :" + myBalance);
}
else if (operationAns.operation === "checkBalance") {
console.log("Your balance is" + myBalance);
}
}
else {
console.log("Incorrect PIN code !!!");
}