From fa3f20a54b09312859ade8e305328705b216e8e2 Mon Sep 17 00:00:00 2001 From: Zahra Gharagozloo Mazlaghan Date: Wed, 10 Jun 2026 22:12:23 +0330 Subject: [PATCH] Class Student completed. --- .idea/.gitignore | 10 ++++++++++ .idea/compiler.xml | 13 +++++++++++++ .idea/encodings.xml | 7 +++++++ .idea/jarRepositories.xml | 20 ++++++++++++++++++++ .idea/misc.xml | 12 ++++++++++++ .idea/vcs.xml | 6 ++++++ src/main/java/dev/model/Student.java | 25 +++++++------------------ 7 files changed, 75 insertions(+), 18 deletions(-) create mode 100644 .idea/.gitignore create mode 100644 .idea/compiler.xml create mode 100644 .idea/encodings.xml create mode 100644 .idea/jarRepositories.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/vcs.xml diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..ab1f416 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,10 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Ignored default folder with query files +/queries/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml +# Editor-based HTTP Client requests +/httpRequests/ diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..a590144 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..aa00ffa --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml new file mode 100644 index 0000000..105dbd3 --- /dev/null +++ b/.idea/jarRepositories.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..eba6e1f --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,12 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/main/java/dev/model/Student.java b/src/main/java/dev/model/Student.java index f0484f4..f9bdbb1 100644 --- a/src/main/java/dev/model/Student.java +++ b/src/main/java/dev/model/Student.java @@ -40,31 +40,20 @@ public class Student { @Override public int hashCode() { - - // TODO: - // Return custom hash - - // Example: - // return id % 97; - - return 0; + return this.getId() % 97; } @Override public boolean equals(Object obj) { + if (obj == null) return false; + + if (this == obj) return true; - // TODO: + if (this.getClass() != obj.getClass()) return false; - // Step 1: - // Check null + Student other = (Student) obj; - // Step 2: - // Convert obj to Student - - // Step 3: - // Compare IDs - - return false; + return this.id == other.id; } @Override