{"id":24021211,"url":"https://github.com/zipcodecore/gradedstudents","last_synced_at":"2025-04-15T21:16:31.447Z","repository":{"id":46008067,"uuid":"105730180","full_name":"ZipCodeCore/GradedStudents","owner":"ZipCodeCore","description":null,"archived":false,"fork":false,"pushed_at":"2021-11-20T22:51:17.000Z","size":48,"stargazers_count":0,"open_issues_count":55,"forks_count":47,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-04-15T21:16:25.096Z","etag":null,"topics":["corejava","corejava-chapter3-section10","corejava-chapter3-section8","corejava-chapter4"],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ZipCodeCore.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-10-04T04:03:16.000Z","updated_at":"2022-10-14T16:03:08.000Z","dependencies_parsed_at":"2022-07-20T18:32:08.656Z","dependency_job_id":null,"html_url":"https://github.com/ZipCodeCore/GradedStudents","commit_stats":null,"previous_names":[],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZipCodeCore%2FGradedStudents","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZipCodeCore%2FGradedStudents/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZipCodeCore%2FGradedStudents/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZipCodeCore%2FGradedStudents/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ZipCodeCore","download_url":"https://codeload.github.com/ZipCodeCore/GradedStudents/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249153950,"owners_count":21221330,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["corejava","corejava-chapter3-section10","corejava-chapter3-section8","corejava-chapter4"],"created_at":"2025-01-08T12:40:00.982Z","updated_at":"2025-04-15T21:16:31.428Z","avatar_url":"https://github.com/ZipCodeCore.png","language":"Java","readme":"# Graded Students Lab\n* **Purpose** - to demonstrate the use of [Java classes](https://docs.oracle.com/javase/tutorial/java/concepts/class.html) and [data encapsulation](https://en.wikipedia.org/wiki/Data_encapsulation).\n* **Objective** - to create a `Classroom` which manipulates a composite `List` of `Student` objects which contain data detailing their `firstName`, `lastName`, and `examScores`.\n* **Restrictions** - Ensure positive and negative unit tests exist per feature of the application\n\n\n\n## Part 1; Create class `Student`\n* Create a class `Student`.\n\n\n\n\n\n\n\n\n\n\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\n\n### Part 1.1; Defining instance variables\n* Declare an instance variable for each of the previously mentioned properties:\n\t* `String firstName`\n\t\t* a collection of characters representative of a first name.\n\t* `String lastName`\n\t\t* a collection of characters representative of a last name.\n\t* `ArrayList\u003cDouble\u003e examScores`\n\t\t* a dynamic collection of decimal values representative of test scores.\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\n\n### Part 1.2; Defining construction\n* Define a `Student` constructor whose parameters are used to initalize its instance variables.\n* The `Student` constructor has expected parameters of\n\t* `String` representative of a `firstName` \n\t* `String` representative of a `lastName`\n\t* `Double[]` representative of a collection of `testScores`\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\n\n### Part 1.3; Defining methods\n\n* **Getters and Setters**\n\t* Define a [getter and setter](https://en.wikipedia.org/wiki/Mutator_method#Java_example) for each of the instance variables declared in the `Student` class.\n\t\t* **Note:** There should not be a `setter` for the `testScore`. This object's [state](https://cs.stackexchange.com/questions/6536/definition-of-the-state-of-an-object-in-oop) will be [mutated](https://en.wikibooks.org/wiki/Scheme_Programming/Mutability) via a `takeExam` method mentioned below.\n\t\t* Additionally, define a getter, `getNumberOfExamsTaken()`, which returns the total number of exams taken by this student.\n\n\n\n\n\n\n\n\n\n\n\n\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\n\n* **Define method `getExamScores()`**\n\t* `Student` should define a method which returns a string representation of all exams taken.\n\n\t\t* Sample Script:\n\t\t\n\t\t\t```\n\t\t\t// : Given\n\t\t\tString firstName = \"Leon\";\n\t\t\tString lastName = \"Hunter\";\n\t\t\tDouble[] examScores = { 100.0, 95.0, 123.0, 96.0 };\n\t\t\tStudent student = new Student(firstName, lastName, examScores);\n\t\t\t\n\t\t\t// When\n\t\t\tString output = student.getExamScores();\n\t\t\t\n\t\t\t// Then\n\t\t\tSystem.out.println(output);\n\t\t\t```\n\t\t* Sample Output\n\t\t\n\t\t\t```\n\t\t\tExam Scores:\n\t\t\t\tExam 1 -\u003e 100\n\t\t\t\tExam 2 -\u003e 95\n\t\t\t\tExam 3 -\u003e 123\n\t\t\t\tExam 4 -\u003e 96\n\t\t\t```\n\n\n\n\n\n\n\n\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\n\n* **Define method `addExamScore(double examScore)`**\n\t* `Student` should define a method named `addExamScore` which uses a `double` parameter to add an `examScore` to its composite List `examScores`.\n\n\t\t* Sample Script:\n\t\t\n\t\t\t```\n\t\t\t// : Given\n\t\t\tString firstName = \"Leon\";\n\t\t\tString lastName = \"Hunter\";\n\t\t\tDouble[] examScores = { };\n\t\t\tStudent student = new Student(firstName, lastName, examScores);\n\t\t\t\n\t\t\t// When\n\t\t\tstudent.addExamScore(100.0);\n\t\t\tString output = student.getExamScores();\n\t\t\t\n\t\t\t// Then\n\t\t\tSystem.out.println(output);\n\t\t\t```\n\t\t* Sample Output\n\t\t\n\t\t\t```\n\t\t\tExam Scores:\n\t\t\t\tExam 1 -\u003e 100\n\t\t\t```\n\n\n\n\n\n\n\n\n\n\n\n\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\n\n* **Define method `setExamScore(int examNumber, double newScore)`**\n\t* `Student` should define a method named `setExamScore` which uses an `int` parameter to identify an exam in the list, and a `double` parameter to re-assign the respective value.\n\n\t\t* Sample Script:\n\t\t\n\t\t\t```\n\t\t\t// : Given\n\t\t\tString firstName = \"Leon\";\n\t\t\tString lastName = \"Hunter\";\n\t\t\tDouble[] examScores = { 100.0 };\n\t\t\tStudent student = new Student(firstName, lastName, examScores);\n\t\t\t\n\t\t\t// When\n\t\t\tstudent.setExamScore(1, 150.0);\n\t\t\tString output = student.getExamScores();\n\t\t\t\n\t\t\t// Then\n\t\t\tSystem.out.println(output);\n\t\t\t```\n\t\t* Sample Output\n\t\t\n\t\t\t```\n\t\t\tExam Scores:\n\t\t\t\tExam 1 -\u003e 150\n\t\t\t```\n \n \n \n \n \n \n \n\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\n\n* **Define method `getAverageExamScore()`**\n\t* `Student` should define a method named `getAverageExamScore()` which returns the sum of the `examScore` list divided by its `size`.\n\n\n\t\t* Sample Script:\n\t\t\n\t\t\t```\n\t\t\t// : Given\n\t\t\tString firstName = \"Leon\";\n\t\t\tString lastName = \"Hunter\";\n\t\t\tDouble[] examScores = { 100.0, 150.0, 250.0, 0.0 };\n\t\t\tStudent student = new Student(firstName, lastName, examScores);\n\t\t\t\n\t\t\t// When\n\t\t\tDouble output = student.getAverageExamScore();\n\t\t\t\n\t\t\t// Then\n\t\t\tSystem.out.println(output);\n\t\t\t```\n\t\t* Sample Output\n\t\t\n\t\t\t```\n\t\t\t125.0\n\t\t\t```\n\t\t\t\n\t\t\t\n\n\n\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\n\n* **Define method `toString()`**\n\t* `Student` should [override](https://docs.oracle.com/javase/tutorial/java/IandI/override.html) the `toString` method by returning a clean `String` representation of the person.\n\n\n\t\t* Sample Script:\n\t\t\n\t\t\t```\n\t\t\t// : Given\n\t\t\tString firstName = \"Leon\";\n\t\t\tString lastName = \"Hunter\";\n\t\t\tDouble[] examScores = { 100.0, 150.0, 250.0, 0.0 };\n\t\t\tStudent student = new Student(firstName, lastName, examScores);\n\t\t\t\n\t\t\t// When\n\t\t\tString output = student.toString();\n\t\t\t\n\t\t\t// Then\n\t\t\tSystem.out.println(output);\n\t\t\t```\n\t\t* Sample Output\n\t\t\n\t\t\t```\n\t\t\tStudent Name: Leon Hunter\n\t\t\t\u003e Average Score: 125\n\t\t\t\u003e Exam Scores:\n\t\t\t    Exam 1 -\u003e 100\n\t\t\t    Exam 2 -\u003e 150\n\t\t\t    Exam 3 -\u003e 250\n\t\t\t    Exam 4 -\u003e 0\n\t\t\t```\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\n\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\n\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\n\n## Part 2; Create class `Classroom`\n* Create a class `Classroom`\n\n\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\n\n### Part 2.1; Defining instance variables\n* Declare an instance variable for each of the `Classroom` properties:\n\t* `Student[] students`\n\t\t* a collection of student objects\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\n\n### Part 2.2; Defining construction\n* Define a `Classroom` constructor whose parameters are used to initalize its instance variable. The class `Classroom` should support 3 different ways of being constructed.\n\t\n\t1. The class `Classroom` should define a constructor which takes an argument of an `int` representative of the `maxNumberOfStudents` that this `Classroom` can hold.\n\t\n\t2. The class `Classroom` should define an additional constructor which takes an argument of `Student[]` representative of the collection of `Student` objects this `Classroom` will store.\n\t\n\t3. The class `Classroom` should define a [nullary constructor](https://en.wikipedia.org/wiki/Nullary_constructor) which initializes the composite `students` object to be an empty array of 30 `Student` objects.\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\n\n### Part 2.3; Defining methods\n\n* **Define method `getStudents()`**\n\t* Define a getter which returns the composite `students` object.\t\n\n\n\n\n\n\n\n\n\n\n\n\n\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\n\n* **Define method `getAverageExamScore()`**\n\t* Define a getter which returns the sum of all exam averages divided by the number of students.\n\n\n\t\t* Sample Script:\n\t\t\n\t\t\t```\n\t\t\t// : Given\n\t\t\tDouble[] s1Scores = { 100.0, 150.0 };\n\t\t\tDouble[] s2Scores = { 225.0, 25.0 };\n\t\t\t\n\t\t\tStudent s1 = new Student(\"student\", \"one\", s1Scores);\n\t\t\tStudent s2 = new Student(\"student\", \"two\", s2Scores);\n\t\t\t\n\t\t\tStudent[] students = {s1,s2};\n\t\t\tClassroom classroom = new Classroom(students);\n\t\t\t\n\t\t\t// When\n\t\t\tdouble output = classroom.getAverageExamScore();\n\t\t\t\n\t\t\t// Then\n\t\t\tSystem.out.println(output);\n\t\t\t```\n\t\t* Sample Output\n\t\t\n\t\t\t```\n\t\t\t125.0\n\t\t\t```\n\n\n\n\n\n\n\n\n\n\n\n\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\n\n* **Define method `addStudent(Student student)`**\n\t* Define a method which uses a `Student` parameter to add a `Student` object to the composite `students` list.\n\n\n\t\t* Sample Script:\n\t\t\n\t\t\t```\n\t\t\t// : Given\n\t\t\tint maxNumberOfStudents = 1;\n\t\t\tClassroom classroom = new Classroom(maxNumberOfStudents);\n\t\t\tDouble[] examScores = { 100.0, 150.0, 250.0, 0.0 };\n\t\t\tStudent student = new Student(\"Leon\", \"Hunter\", examScores);\t\t\t\n\n\t\t\t// When\n\t\t\tStudent[] preEnrollment = classroom.getStudents();\n\t\t\tclassroom.addStudent(student);\n\t\t\tStudent[] postEnrollment = classroom.getStudents();\n\t\t\t\n\t\t\t// Then\n\t\t\tString preEnrollmentAsString = Arrays.toString(preEnrollment);\n\t\t\tString postEnrollmentAsString = Arrays.toString(postEnrollment);\n\n\t\t\tSystem.out.println(\"===========================\");\n\t\t\tSystem.out.println(preEnrollmentAsString);\n\t\t\tSystem.out.println(\"===========================\");\n\t\t\tSystem.out.println(postEnrollmentAsString);\n\t\t\t```\n\t\t* Sample Output\n\t\t\n\t\t\t```\n\t\t\t===========================\n\t\t\t[]\n\t\t\t===========================\n\t\t\t[Student Name: Leon Hunter\n\t\t\t\u003e Average Score: 125\n\t\t\t\u003e Exam Scores:\n\t\t\t    Exam 1 -\u003e 100\n\t\t\t    Exam 2 -\u003e 150\n\t\t\t    Exam 3 -\u003e 250\n\t\t\t    Exam 4 -\u003e 0]\n\t\t\t```\n\t\t\t\n\t\t\t\n\n\n\n\n\n\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\n\n* **Define method `removeStudent(String firstName, String lastName)`**\n\t* The class `Classroom` should define a method which uses a `firstName` and `lastName` parameter to identify and remove the respective student from composite `students` object.\n\t* Ensure the array is re-ordered after the removal; Null values should be located in the final indices of the array.\n\n\n\n\n\n\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\n\n* **Define method `getStudentsByScore()`**\n\t* The class `Classroom` should define a method `getStudentsByScore()` which returns an array representation of `Student` objects sorted in descending order by score. \n\t* If two students have the same class average, order them lexigraphically.\n\n\n\n\n\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\n\n* **Define method `getGradeBook()`**\n\t* The class `Classroom` should define a method `getGradeBook()` which returns a mapping of `Student` objects to a respective letter grade determined by creating a [grading curve](https://en.wikipedia.org/wiki/Grading_on_a_curve) such that\n\t\t* An `A` is awarded to students whose class average is in the upper 10th percentile.\n\t\t* A `B` is awarded to students whose class average falls between the upper 11th and 29th percentile.\n\t\t* A `C` is awarded to students whose class average falls between the upper 30th and 50th percentile.\n\t\t* A `D` is awarded to students whose class average falls between the lower 51st and 89th percentile.\n\t\t* An `F` is awarded to students whose class average is in the lower 11th percentile.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzipcodecore%2Fgradedstudents","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzipcodecore%2Fgradedstudents","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzipcodecore%2Fgradedstudents/lists"}