-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
48 lines (48 loc) · 1.81 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
38
39
40
41
42
43
44
45
46
47
48
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var library_1 = require("./classes/library");
var readlineSync = require('readline-sync');
var Library = new library_1.library();
var choice = 0;
while (1) {
console.log("Welcome to Book Managemnt System");
console.log(" 1. Add Book");
console.log(" 2. Display Available Books");
console.log(" 3. Search Books");
console.log(" 4. Add User");
console.log(" 5. Issue Book");
console.log(" 6. Return Book");
console.log(" 7. Remove Book");
console.log(" 8. Exit from Book Management System");
do {
choice = parseInt(readlineSync.question('Enter your choice:'));
} while (choice < 1 || choice > 8);
switch (choice) {
case 1:
Library.FaddBook(readlineSync.question('Enter Title of the book:'), readlineSync.question('Enter Author of the book:'));
break;
case 2:
Library.FlistBooks();
break;
case 3:
Library.FsearchBook(readlineSync.question('Enter Title of the book or Author of the Book:'));
break;
case 4:
Library.FaddUser(readlineSync.question('Enter your name:'));
break;
case 5:
Library.FissueBook(readlineSync.question('Enter your user name:'), readlineSync.question('Enter title of the book you want:'));
break;
case 6:
Library.FretunBook(readlineSync.question('Enter title of the book:'), readlineSync.question('Enter user name:'));
break;
case 7:
Library.FremoveBook(readlineSync.question('Enter Title of the book:'));
break;
case 8:
process.exit(0);
default:
console.log("Choose an option from 1 - 8");
break;
}
}