-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMain.java
54 lines (44 loc) · 1.86 KB
/
Main.java
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
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
ServerConnection controller = new ServerConnection();
System.out.println("Welcome to the CRUD Apllication!!\n1. Show Data\n2. Add Data\n3. Update Data\n4. Delete Data");
while (true) {
System.out.println("Choose the operations you have to perform(1-4)");
int choice = sc.nextInt();
switch (choice) {
case 1:
controller.readTable();
break;
case 2:
System.out.print("Enter first name: ");
String fname = sc.nextLine();
System.out.print("\nEnter last name: ");
String lname = sc.nextLine();
System.out.print("\nEnter Age: ");
int age = sc.nextInt();
controller.createRecord(fname, lname, age);
break;
case 3:
System.out.println("Enter new First Name: ");
String newName = sc.nextLine();
System.out.println("Enter the Class Id: ");
int Clid = sc.nextInt();
controller.updateRecord(newName,Clid);
break;
case 4:
System.out.println("Enter First Name: ");
String fName = sc.nextLine();
System.out.println("Enter Last Name: ");
String lName = sc.nextLine();
System.out.println("Enter Age Name: ");
int age_DB = sc.nextInt();
controller.deleteRecord(fName, lName, age_DB);
break;
default:
break;
}
}
}
}