-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStudent.java
More file actions
30 lines (25 loc) · 798 Bytes
/
Student.java
File metadata and controls
30 lines (25 loc) · 798 Bytes
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
package unit_07.Examples.Example_06;
import java.util.Scanner;
public class Student {
static Scanner sc = new Scanner(System.in);
protected String name;
protected long studentId;
protected float grade;
public void getInfo() {
System.out.println("Enter Student's Name: ");
name = sc.nextLine();
System.out.println("Enter Student's ID: ");
studentId = sc.nextLong();
System.out.println("Enter Student's Grade: ");
grade = sc.nextFloat();
sc.nextLine();
}
public void showInfo() {
System.out.print(studentId + "\t\t");
System.out.print(name.trim() + "\t\t");
System.out.print(grade + "\n");
}
public void showTitle() {
System.out.println("\nID\t\tName\t\tGrade");
}
}