-
Notifications
You must be signed in to change notification settings - Fork 93
/
Copy pathSchool Management System
147 lines (129 loc) · 2.37 KB
/
School Management System
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
import java.util.*;
class School
{
// Variables
static String schoolName = "Modern Public School";
static int schoolId = 12345;
static String name;
static int age;
static long phone;
//methods main, first, second, third, fourth, fifth
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("-------------WELCOME----------------");
System.out.println("1. Class 1st");
System.out.println("2. Class 2nd");
System.out.println("3. Class 3rd");
System.out.println("4. Class 4th");
System.out.println("5. Class 5th");
System.out.println("6. EXIT");
System.out.println("Enter your desired class in you want to go");
int choice = sc.nextInt();
switch(choice)
{
case 1:
{
first();
break;
}
case 2:
{
second();
break;
}
case 3:
{
third();
break;
}
case 4:
{
fourth();
break;
}
case 5:
{
fifth();
break;
}
case 6:
{
System.exit(0);
break;
}
default:
{
System.out.println("wrong choice");
break;
}
}
}
public static void input()
{
//Making object of sports class
Sports sp = new Sports();
Scanner sc = new Scanner(System.in);
System.out.println("Enter your name/age/phone with space between");
name = sc.nextLine();
age = sc.nextInt();
phone = sc.nextLong();
if(age>=15)
{
sp.sportin();
}
}
public static void output()
{
//Making object of sports class
Sports sp = new Sports();
System.out.println("Your details:");
System.out.println("Name: \t"+name);
System.out.println("Age:\t"+age);
System.out.println("Phone:\t"+phone);
System.out.println("School Name\t:"+schoolName);
System.out.println("School ID:\t"+schoolId);
if(sp.sportname != null)
{
sp.sportout();
}
}
public static void first()
{
input();
output();
}
public static void second()
{
input();
output();
}
public static void third()
{
input();
output();
}
public static void fourth()
{
input();
output();
}
public static void fifth()
{
input();
output();
}
}
class Sports
{
static String sportname;
public static void sportin()
{
System.out.println("Enter your desired sports");
Scanner sc = new Scanner(System.in);
sportname = sc.nextLine();
}
public static void sportout()
{
System.out.println("Selected desired Sports name is : "+sportname);
}
}