From b9154e155fe77ebcb9564f7c7580f1599d81d9a5 Mon Sep 17 00:00:00 2001 From: fdai7887 Date: Tue, 6 Feb 2024 18:36:26 +0100 Subject: [PATCH] refactoring: Student class --- src/main/java/org/example/Student.java | 32 ++++++++++++-------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/src/main/java/org/example/Student.java b/src/main/java/org/example/Student.java index 64eb6e1..9342c31 100644 --- a/src/main/java/org/example/Student.java +++ b/src/main/java/org/example/Student.java @@ -1,10 +1,8 @@ package org.example; -import java.util.ArrayList; -import java.util.List; public class Student { - String StudentName; - String StudentID; + String name; + String id; String role; public Student(){ @@ -12,29 +10,29 @@ public class Student { } public Student(String name, String id, String role) { - this.StudentName = name; - this.StudentID = id; + this.name = name; + this.id = id; this.role = role; } - public String getStudentName() { - return StudentName; + public String getName() { + return name; } - public String getStudentID() { - return StudentID; + public String getId() { + return id; } public String getRole() { return role; } - public void setStudentName(String studentName) { - StudentName = studentName; + public void setName(String name) { + this.name = name; } - public void setStudentID(String studentID) { - StudentID = studentID; + public void setId(String id) { + this.id = id; } public void setRole(String role) { @@ -42,9 +40,9 @@ public class Student { } public void printStudentInfo() { - System.out.println("Name: " + getStudentName()); - System.out.println("ID: " + getStudentID()); - System.out.println("role: " + getRole()); + System.out.println("Name: " + getName()); + System.out.println("ID: " + getId()); + System.out.println("Role: " + getRole()); } }