-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
61 lines (61 loc) · 1.84 KB
/
index.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import inquirer from "inquirer";
import chalk from "chalk";
let myBalance = 9999;
let myPin = 12345;
let pinNumber = await inquirer.prompt([
{
name: "pin",
type: "number",
message: "enter your pin number !",
},
]);
if (pinNumber.pin === myPin) {
console.log(chalk.green("your pin number is correct !"));
let operationAns = await inquirer.prompt([
{
name: "operator",
type: "list",
message: "select your operator !",
choices: ["withdrawl !", "fast cash !", "check balance !"],
},
]);
if (operationAns.operator === "withdrawl !") {
let myAmount = await inquirer.prompt([
{
name: "amount",
type: "number",
message: "enter your amoount !",
},
]);
if (myBalance >= myAmount.amount) {
myBalance -= myAmount.amount;
console.log(chalk.blue(`your remining amount is ${myBalance} !`));
}
else {
console.log(chalk.red("insuficaint balance !"));
}
}
if (operationAns.operator === "fast cash !") {
let myAmount = await inquirer.prompt([
{
name: "amount",
type: "list",
message: "select your option !",
choices: ["1000", "5000", "9999", "10000"],
},
]);
if (myBalance >= myAmount.amount) {
myBalance -= myAmount.amount;
console.log(chalk.blue(`your reminig amount is ${myBalance} !`));
}
else {
console.log(chalk.red("insuficaint balance !"));
}
}
else if (operationAns.operator === "check balance !") {
console.log(chalk.green(`your total balnce is ${myBalance}`));
}
}
else {
console.log(chalk.red("wrong pin number !"));
}