-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadmission.java
83 lines (81 loc) · 2.23 KB
/
admission.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
import java.util.*;
import java.util.Scanner;
class student{
String name,dept;
student(String name, String dept)
{
this.name=name;
this.dept=dept;
}
}
class Techno{
student std[];
int count;
Scanner sc= new Scanner(System.in);
Techno(int size)
{
std=new student[size];
count=0;
}
public void stdadd()
{
if(count==std.length)
{
System.out.println("No Vacancy Available.");
}
else
{
//Scanner sc= new Scanner(System.in);
System.out.print("Enter the name of the student: ");
String name=sc.nextLine();
System.out.print("Enter the dept. of the student: ");
String dept=sc.nextLine();
student ob= new student(name,dept);
std[count++]=ob;
}
}
public void display()
{
if(count==0)
System.out.println("No New Admission");
else
{
for(int i=0;i<count;i++)
{
System.out.print("No. "+(i+1)+" student details: "+" Name: "+std[i].name+" Dept.: "+std[i].dept+"\n");
}
}
}
}
public class admission{
public static void main(String arg[])
{
Scanner sc=new Scanner(System.in);
Techno TISL=new Techno(10);
Techno NSEC=new Techno(8);
Techno BIT=new Techno(5);
while(true)
{
System.out.print("Press 1 for TISL\nPress 2 for NSEC\nPress 3 for BIT\nPress 4 for Display TISL\nPress 5 for Display NSEC\nPress 6 for Display BIT\nPress 7 for Exit\n");
System.out.print("Enter your choice: ");
int ch=sc.nextInt();
switch(ch)
{
case 1: TISL.stdadd();
break;
case 2: NSEC.stdadd();
break;
case 3: BIT.stdadd();
break;
case 4: TISL.display();
break;
case 5: NSEC.display();
break;
case 6: BIT.display();
break;
case 7: System.exit(0);
default: System.out.println("Wrong Choice!");
}
}
}
}