-
Notifications
You must be signed in to change notification settings - Fork 0
/
JS_Bot.js
68 lines (54 loc) · 1.59 KB
/
JS_Bot.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
62
63
64
65
66
67
68
const input = require('sync-input');
function greet(bot_name, birth_year) {
console.log("Hello! My name is " + bot_name + ".");
console.log("I was created in " + birth_year + ".");
}
function remind_name() {
console.log("Please, remind me your name.");
let name = input();
console.log("What a great name you have, " + name + "!");
}
function guess_age() {
console.log("Let me guess your age.");
console.log("Enter remainders of dividing your age by 3, 5 and 7.");
let rem3 = Number(input());
let rem5 = Number(input());
let rem7 = Number(input());
let age = (rem3 * 70 + rem5 * 21 + rem7 * 15) % 105;
console.log("Your age is " + age + "; that's a good time to start programming!");
}
function count() {
console.log("Now I will prove to you that I can count to any number you want.");
let number = Number(input());
let current = 0;
while (current <= number) {
console.log(current + " !");
current += 1;
}
}
function test() {
console.log("Let's test your programming knowledge.");
console.log("Why do we use methods?");
console.log("1. To repeat a statement multiple times.");
console.log("2. To decompose a program into several small subroutines.");
console.log("3. To determine the execution time of a program.");
console.log("4. .");
let n;
do {
let n = input();
if( n == 2){
break;
}else{
console.log("Please, try again.");
}
} while (n != 2);
}
function end() {
console.log("Congratulations, have a nice day!");
}
greet('System', '2022') // change it as you need
remind_name();
guess_age();
count();
test();
end();