forked from Edwinliby/Hacktoberfest2022
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CollegeManagement.java
160 lines (127 loc) · 4.5 KB
/
CollegeManagement.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
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
import java.util.*;
class Student{
private String NAME;
private String RollNumber;
private int UgYear;
private String Branch;
private float CGPA ;
public void setNAME(String NAME) {
this.NAME = NAME;
}
public void setRollNumber(String rollNumber) {
RollNumber = rollNumber;
}
public void setUgYear(int ugYear) {
UgYear = ugYear;
}
public void setBranch(String branch) {
Branch = branch;
}
public void setCGPA(float CGPA) {
this.CGPA = CGPA;
}
public String getNAME() {
return NAME;
}
public String getRollNumber() {
return RollNumber;
}
public int getUgYear() {
return UgYear;
}
public String getBranch() {
return Branch;
}
public float getCGPA() {
return CGPA;
}
}
class Teacher{
private String TeacherName;
private long TeacherID;
private String Department;
private String Specialization;
public void setTeacherName(String teacherName) {
TeacherName = teacherName;
}
public void setTeacherID(long teacherID) {
TeacherID = teacherID;
}
public void setDepartment(String department) {
Department = department;
}
public void setSpecialization(String specialization) {
Specialization = specialization;
}
public String getTeacherName() {
return TeacherName;
}
public long getTeacherID() {
return TeacherID;
}
public String getDepartment() {
return Department;
}
public String getSpecialization() {
return Specialization;
}
}
public class CollegeManagement {
public static void main(String[] args){
Scanner scanNum = new Scanner(System.in);
Scanner scanString = new Scanner(System.in);
// String ==> studentName,RollNo,Branch,teacherName,department,specialization;
// long ==> teacherID;
// int ==> ug year;
// float ==> cgpa;
System.out.println("enter numbers of Student's data to add");
int studentData = scanNum.nextInt();
System.out.println("enter numbers of Teacher's data to add");
int teachersData = scanNum.nextInt();
Student[] StudentData = new Student[studentData];
Teacher[] TeacherData = new Teacher[teachersData];
for (int i =0 ; i< studentData;i++){
StudentData[i] = new Student();
}
for (int i =0 ; i< teachersData;i++){
TeacherData[i] = new Teacher();
}
System.out.println("Enter students data respectively");
for (int j=0;j<studentData;j++)
{
System.out.println((j+1)+").enter studentName,RollNo,Branch, UG year, cgpa respectively ");
StudentData[j].setNAME(scanString.next());
StudentData[j].setRollNumber(scanString.next());
StudentData[j].setBranch(scanString.next());
StudentData[j].setUgYear(scanNum.nextInt());
StudentData[j].setCGPA(scanNum.nextFloat());
}
System.out.println("Enter students data respectively");
for (int k=0;k<teachersData;k++)
{
System.out.println((k+1)+").Enter teacher name, teacherID , Department, specialization");
TeacherData[k].setTeacherName(scanString.next());
TeacherData[k].setTeacherID(scanString.nextLong());
TeacherData[k].setDepartment(scanString.next());
TeacherData[k].setSpecialization(scanString.next());
}
System.out.println("Data added successfully");
for (int j=0;j<3;j++)
{
System.out.println("----****STUDENT DATA NO. "+(j+1)+" ****----");
System.out.println(StudentData[j].getNAME());
System.out.println(StudentData[j].getRollNumber());
System.out.println(StudentData[j].getBranch());
System.out.println(StudentData[j].getUgYear());
System.out.println(StudentData[j].getCGPA());
}
for (int k=0;k<3;k++)
{
System.out.println("----****Teacher DATA NO. "+(k+1)+" ****----");
System.out.println(TeacherData[k].getTeacherName());
System.out.println(TeacherData[k].getTeacherID());
System.out.println(TeacherData[k].getDepartment());
System.out.println(TeacherData[k].getSpecialization());
}
}
}