fork download
  1. import java.util.Scanner;
  2.  
  3. /**
  4.  *
  5.  * @author Bruka
  6.  */
  7. class ideone {
  8.  
  9. /**
  10.   * @param args the command line arguments
  11.   */
  12. public static void main(String[] args) {
  13. // TODO code application logic here
  14.  
  15. Scanner input = new Scanner(System.in);
  16.  
  17. Student std = new Student();
  18.  
  19. System.out.println("plz , inter id :");
  20. std.setId(input.nextInt());
  21. input.nextLine();
  22. System.out.println("plz , inter name :");
  23. std.setName(input.nextLine());
  24.  
  25. System.out.println("plz , inter Age :");
  26. std.setAge(input.nextInt());
  27. input.nextLine();
  28. System.out.println("plz , inter department :");
  29. std.setDepartment(input.nextLine());
  30.  
  31. System.out.println("plz , inter GPA :");
  32. std.setGpa(input.nextFloat());
  33.  
  34. std.printStudentInfo();
  35. }
  36.  
  37. }
  38. class Student {
  39.  
  40. private int id;
  41. private String name;
  42. private int age;
  43. private String department;
  44. private float gpa;
  45.  
  46. public void setId(int Pid) {
  47. this.id = Pid;
  48. }
  49.  
  50. public int getId() {
  51. return this.id;
  52. }
  53.  
  54. public void setName(String Pname)
  55.  
  56. {
  57. this.name = Pname;
  58. }
  59.  
  60. public String getName() {
  61. return this.name;
  62. }
  63.  
  64. public void setAge(int Page) {
  65. this.age = Page;
  66. }
  67.  
  68. public int getAge() {
  69. return this.age;
  70. }
  71.  
  72. public void setDepartment(String Pdepartment) {
  73. this.department = Pdepartment;
  74. }
  75.  
  76. public String getDepartment() {
  77. return this.department;
  78. }
  79.  
  80. public void setGpa(float Pgpa) {
  81. this.gpa = Pgpa;
  82. }
  83.  
  84. public float getGpa() {
  85. return this.gpa;
  86. }
  87.  
  88. public void printStudentInfo() {
  89. System.out.println("-------------- " + "[" + this.id + "]" + " "
  90. + this.name.toUpperCase() + " -----------------");
  91. System.out.println("age : " + this.age);
  92. System.out.println("Department : " + this.department);
  93. System.out.println("Gpa : " + this.gpa);
  94. }
  95. }
Success #stdin #stdout 0.16s 321088KB
stdin
234
John Do
23
3455
65654
stdout
plz , inter id :
plz , inter name :
plz , inter Age :
plz , inter department :
plz , inter GPA :
--------------  [234]  JOHN DO -----------------
age : 23
Department : 3455
Gpa : 65654.0