-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMethods.java
More file actions
100 lines (81 loc) · 4.24 KB
/
Methods.java
File metadata and controls
100 lines (81 loc) · 4.24 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
package TeacherRegister;
import java.util.Scanner;
public class Methods {
public static void menu() throws ClassNotFoundException {
Scanner scp = new Scanner(System.in);
System.out.println("*\t MENU \t \t*");
System.out.println("*\t \t \t \t \t \t \t \t \t \t*");
System.out.println("*\t Enter 1: To enter a student record \t \t*");
System.out.println("*\t Enter 2: To delete student record \t \t*");
System.out.println("*\t Enter 3: To update student record \t \t*");
System.out.println("*\t Enter 4: To view one student record \t \t*");
System.out.println("*\t Enter 5: To view all student record(s) \t \t*");
System.out.println("*\t \t \t \t \t \t \t \t \t \t*");
System.out.println("*\t*\t*\t*\t*\t*\t*\t*\t*\t*\t*\t*\t*\t*");
int input = scp.nextInt();
int check = 0;
switch(input) {
case 1:
Scanner sc = new Scanner(System.in);
Scanner scr = new Scanner(System.in);
InsertStudentRecords app = new InsertStudentRecords();
SelectStudentRecords appprint4 = new SelectStudentRecords();
System.out.println("Enter the number of student you want to enter the marks for:");
int students = sc.nextInt();
for(int i = 1; i<=students; i++)
{
System.out.println("Enter the name of the student:");
String name = scr.nextLine();
System.out.println("Enter the Roll number of "+ name+ ": ");
int RollNo = sc.nextInt();
System.out.println("Enter the math marks of "+name+": ");
double marks = sc.nextDouble();
app.insert(RollNo, name, marks);
}
System.out.println("RollNo\tName\tMarks");
appprint4.selectAll();
break;
case 2:
System.out.println("Enter the RollNo of the student you want to delete:");
int deleterollno = scp.nextInt();
DeleteRecord delrecord = new DeleteRecord();
SelectStudentRecords appprint = new SelectStudentRecords();
delrecord.delete(deleterollno);
System.out.println("RollNo\tName\tMarks");
appprint.selectAll();
break;
case 3:
System.out.println("Enter the RollNo of the student you want to update:");
int updatestudent = scp.nextInt();
System.out.println("Enter the new marks of the student:");
double newmarks = scp.nextDouble();
System.out.println("Operation Successful!\nUpdated register: ");
UpdateRecord updrecord = new UpdateRecord();
SelectStudentRecords appprint2 = new SelectStudentRecords();
updrecord.update(updatestudent, newmarks);
System.out.println("RollNo\tName\tMarks");
appprint2.selectAll();
break;
case 4:
System.out.println("Enter the RollNo of the Student Record you want to view:");
int specific = scp.nextInt();
SelectSpecific speci = new SelectSpecific();
speci.select(specific);
break;
case 5:
SelectStudentRecords appprint3 = new SelectStudentRecords();
System.out.println("RollNo\tName\tMarks");
appprint3.selectAll();
break;
case 6:
System.out.println("Enter the RollNo of the student you want to caclulate the percentage of:");
int perroll = scp.nextInt();
Percentage per = new Percentage();
per.select(perroll);
break;
default:
System.out.println("*\t*\t*\t*\t*\t ERROR PLEASE TRY AGAIN \t*\t*\t*\t*\t*");
Methods.menu();
}
}
}