Welcome! This repo is your starter code for Module 1.
You will implement:
IntArrayToolkit(utility methods forint[])Student(validated data model)StudentArrayToolkit(sorting/searching overStudent[])Main(small demo runner for your video)
✅ Autograding: Your score is based on passing the included JUnit tests (run locally with Maven, and on GitHub Actions).
All source files must start with:
package edu.sdccd.cisc191;Your folder structure must match:
src/main/java/edu/sdccd/cisc191/
If your package or folder path differs, autograding will fail.
Implement:
public static int sum(int[] a)- throws
IllegalArgumentExceptionifais null
- throws
public static int max(int[] a)- throws
IllegalArgumentExceptionifais null or empty
- throws
public static int indexOf(int[] a, int target)- returns index of first occurrence, or
-1if not found - throws
IllegalArgumentExceptionifais null
- returns index of first occurrence, or
public static int[] copySortedAscending(int[] a)- returns a NEW sorted array (ascending)
- must NOT modify original
- throws
IllegalArgumentExceptionifais null
Fields:
name(String),gpa(double),id(int)
Constructor validation:
- name not null/blank
- gpa in
[0.0, 4.0] - id > 0
ThrowIllegalArgumentExceptionif invalid.
Also include:
- getters
toString()readable summary
Implement:
public static Student[] copySortedByGpaDesc(Student[] students)- returns a NEW array sorted by GPA descending
- ties: name ascending
- must NOT modify original
public static Student findByIdLinear(Student[] students, int id)- returns matching student or
null
- returns matching student or
public static Student[] topNByGpa(Student[] students, int n)- returns a NEW array of top N students by GPA desc (ties: name asc)
- if
n> length, return all - if
n< 0, throwIllegalArgumentException
🪄 Lambda preview required: Sorting must use a Comparator created via lambda or method reference (no anonymous inner classes).
(Note: this is graded primarily through peer review, not autograder.)
From terminal:
mvn testIn IntelliJ:
- Open the Maven tool window
- Run
test
Show:
- Your repo structure + correct package line
- Running tests (green)
- Running
Mainand explaining output
Answer these open-ended questions in your video:
- Q1: Where did you use defensive copying and why does it matter?
- Q2: Why can a method modify array contents passed into it?
- Q3: Why is a Comparator lambda useful for sorting objects?
- Q4: What bug did you hit (or avoid) and how did you debug it?
You will complete peer review via GitHub Pull Request:
- Make at least 2 meaningful improvements
- Leave at least 5 review comments
- PR description should explain what changed and why
✅ AI allowed for feedback-writing only (not for generating your partner’s solution code).
Submit your own work. Do not copy from other students or online sources. If you’re unsure whether something is allowed, ask first.