-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmain.java
More file actions
82 lines (76 loc) · 3 KB
/
main.java
File metadata and controls
82 lines (76 loc) · 3 KB
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
69
70
71
72
73
74
75
76
77
78
79
80
81
package com.company;
import java.util.Scanner;
class Library {
// Add Book
public void addBook() {
Scanner sc = new Scanner(System.in);
System.out.println("Please type the Book name you want to add :");
String addBookto = sc.next();
System.out.println("Please Enter your name: ");
String addname = sc.next();
System.out.println("Book Added 👍");
}
public void issueBook() {
Scanner sc = new Scanner(System.in);
System.out.println("Please Enter the book name to be issued :");
String issuebook = sc.next();
System.out.println("Please Enter the person name on whose name it should to be issued :");
String issuername = sc.next();
System.out.println("Book Issued 👍");
}
public void returnBook() {
Scanner sc = new Scanner(System.in);
System.out.println("Enter the book name you want to return :");
String retbook = sc.next();
System.out.println("Please Enter your name: ");
String retname = sc.next();
System.out.println("Book Returned 👍");
}
public void showAvailibleBooks() {
String avaliblecomicbooks[] = {"How To Be Happy", "The Colour Of Earth", "The Early Earth", "Eight Walls",
"Mouse Guard"};
System.out.println("Comic Books Avalible:");
for (String element : avaliblecomicbooks) {
System.out.println(element);
}
String avaliblemarvelbooks[] = {"Wanda Vision", "Empyre", "Thor: The Devourer King", "Guardians Reloaded",
"Immortal Hulk", "Avengers: The Final Host", "Black Panther", "Spider-Man: Back to Basics", "Miles " +
"Morales: Spider-Man ", "Who Is Iron Man?", "Doctor Strange", "Venom", "Star Wars", "Thanos"};
System.out.println(" ");
System.out.println("Marvel Comic Books :");
for (String element:avaliblemarvelbooks) {
System.out.println(element);
}
}
}
public class tuts {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
Library lib = new Library();
// lib.showAvailibleBooks();
// lib.addBook();
// lib.issueBook();
// lib.returnBook();
System.out.println("Welcome to this Libary !!");
System.out.println("Please Enter 1 to Display the Available Books in Libary \n" +
"Please press 2 to Issue A Book in Libary \n" +
"Press 3 to Add A book to the libary and be a part of this Libary \n" +
"Press 4 to return a Issued Book from libary");
int input = sc.nextInt();
if (input == 1) {
lib.showAvailibleBooks();
}
else if (input == 2) {
lib.issueBook();
}
else if (input == 3) {
lib.addBook();
}
else if (input == 4) {
lib.returnBook();
}
else {
System.out.println("Please Enter A valid input to proceed with the program !!");
}
}
}