-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexp1.java
More file actions
97 lines (95 loc) · 2.17 KB
/
exp1.java
File metadata and controls
97 lines (95 loc) · 2.17 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
import java.util.*;
public class exp1
{
public static void main(String args[])
{
int marks[]=new int[10];
String uid[]=new String[10];
String name[]=new String[10];
int ch,i=0;
Scanner in=new Scanner(System.in);
for(i=0;i<10;i++)
{
System.out.println("enter your choice");
System.out.println("press 1 to add data of student");
System.out.println("press 2 to search data of given student");
System.out.println("press 3 to remove data of given student");
System.out.println("press 4 to view the data");
System.out.println("press 5 to give any feedback");
System.out.println("press 0 to exit");
ch=in.nextInt();
if(ch==0)
{
System.out.println("thanks for useing or service");
System.out.println("end of the program ");
break;
}
switch(ch)
{
case 1:
System.out.println("enter the data");
System.out.println("enter the name");
name[i]=in.nextLine();
in.nextLine();
System.out.println("enter the uid");
uid[i]=in.next();
System.out.println("enetr the marks");
marks[i]=in.nextInt();
i=i+1;
break;
case 2:
System.out.println("enter the name of the student");
String x=in.nextLine();
for(i=0;i<name.length;i++)
{
if(name[i]==x)
{
name[i]=name[i+1];
marks[i]=marks[i+1];
uid[i]=uid[i+1];
break;
}
}
break;
case 3:
System.out.println("enter the name of the student to search ");
int c=0;
String f=in.nextLine();
for(i=0;i<name.length;i++)
{
if(name[i]==f)
{
System.out.println("Student is found");
System.out.println("the deatils are as followed");
System.out.println("name is"+name[i]);
System.out.println("uid is "+uid[i]);
System.out.println("marks are"+marks[i]);
c=c+1;
}
}
if(c>=1)
{
System.out.println("no such student in the data plese check for right name or press 1 to add his/her details");
}
break;
case 4:
for(i=0;i<name.length;i++)
{
System.out.println("the deatils are as followed");
System.out.println("name is"+name[i]);
System.out.println("uid is "+uid[i]);
System.out.println("marks are"+marks[i]);
System.out.println("---------------------");
}
break;
case 5:
System.out.println("please enter your feedback");
String fb=in.nextLine();
break;
default:
System.out.println("please check your choice");
break;
}
}
}
}