-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStudentEgMain.java
More file actions
59 lines (57 loc) · 1.48 KB
/
Copy pathStudentEgMain.java
File metadata and controls
59 lines (57 loc) · 1.48 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
/* A java progrma to read the details of students from user and display the given values use class object and method */
import java.util.Scanner;
class Student
{
String name,dob,gender,mob;
int roll;
double marks;
void setDetails(String nm,int rn,String db,String g,String mn,double m)
{
name = nm;
roll = rn;
dob = db;
gender = g;
mob = mn;
marks = m;
}
void getDetails()
{
Scanner sc = new Scanner(System.in);
System.out.print("Enter name : ");
name = sc.nextLine();
System.out.print("Enter roll : ");
roll = sc.nextInt();
sc.nextLine();
System.out.print("Enter DOB : ");
dob = sc.nextLine();
System.out.print("Enter gender : ");
gender = sc.nextLine();
System.out.print("Enter marks : ");
marks = sc.nextDouble();
sc.nextLine();
System.out.print("Enter mobile no. : ");
mob = sc.nextLine();
}
void putDetails()
{
System.out.println("-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-");
System.out.println("Name : "+name);
System.out.println("Roll No. : "+roll);
System.out.println("Marks : "+marks);
System.out.println("D.O.B : "+dob);
System.out.println("Gender : "+gender);
System.out.println("Mobile No. : "+mob);
System.out.println("-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-");
}
}
class StudentEgMain
{
public static void main(String[] args)
{
Student s = new Student();
s.setDetails("Deepak Singh",92,"12/12/2001","Male","9525357044",59.2);
s.putDetails();
s.getDetails();
s.putDetails();
}
}