Assignment | Points | Grade | Evidence |
---|---|---|---|
Pull Request (Integration) | 2 | 1.8 | Original Pull Request & Edited Pull Request |
Relevancy Checklist (Peer) | 2 | (80/90)*2 =1.778 | Tarun’s Peer Review |
Lesson (Group) | 1 | 0.93 | Our score was a 0.93 because we covered the whole of Unit 6 in a very unique way by dividing the team teach into 3 stations. This allowed us to teach our unit with a better student-to-teacher ratio. Because of this, Mr. Mortenson recognized this unique approach and gave us a 0.93. |
Homework, Popcorn Hacks | 1 x 8 | (0.9+0.9+0.92+0.9+0.93+0.91+0.91+0.9)=7.27 | Foundations This project highlights my understanding and knowledge from the homework and popcorn hacks |
Individual Contribution | 1 | 0.93 | Commits on my part of lesson |
Personal Notebooks / Blogs | 1 | 0.93 | |
Total | 15 | (1.8+1.778+0.93+7.27+0.93+0.93)=13.638 |
Skill | Points | Grade | Evidence |
---|---|---|---|
Work Habits (Analytics) | 1 | 0.9 | I always am present in class and participate in class discussions. Also, my GitHub analytics display my dedication to investing time and effort into my learning in CSA, with numerous commits and pull requests for the team teaches. |
Team Planning (Issue) | 1 | 0.9 | Planning and Review |
Presentation Memories | 1 | 0.93 | Had a great time working with my team and created a lot of memories. From this experience in a team setting, I have grown my leadership skills and my ability to work on a collaborative level with others to achieve shared goals. This opportunity has also taught me the importance of effective communication and adaptability in dynamic environments. |
Grading and Feedback | 1 | 0.87 | Grading sheet Our grading was correct, but our scale was off, altering the scores. This led to a uneven and incorrect scores. This experience taught to pay more attention to this and focuses on the scaling or grading of homework. |
Beyond Perfunctory | 1 | 0.93 | We implemented a distinctive and innovative teaching approach by setting up multiple stations, each dedicated to different topics or activities. This method allowed us to break the larger class into smaller, more manageable groups, making it easier to provide personalized attention and cater to individual learning needs. By rotating students through the stations, we were able to create an interactive learning environment that promoted engagement, encouraged hands-on learning, and made complex concepts easier to grasp. This structure not only enhanced student understanding but also improved the overall teaching efficiency. |
Total | 5 | 4.53/5=0.906 |
Sprint 2 Hack
The Student Management System project is a demonstration of various key concepts from the AP Computer Science A curriculum. This interactive system allows users to add, search, delete, and display student records, as well as calculate the average GPA of the students. It showcases how primitive data types, object-oriented programming, and data structures like ArrayLists are used in real-world applications. By including conditional statements, loops, and recursion, the project not only highlights understanding of basic control structures but also demonstrates problem-solving through algorithms and managing data efficiently. This project effectively integrates all ten units of CSA, displaying a comprehensive grasp of Java programming.
import java.util.ArrayList; // Unit 7 (ArrayList): Importing ArrayList for dynamic list storage
import java.util.Scanner; // Unit 2 (Using Objects): Importing Scanner class for user input
class Student {
// Unit 1 (Primitive Types): Using primitive types for student attributes
private String name; // Unit 2 (Using Objects): Using String class for name
private int studentID; // Unit 1 (Primitive Types): int for ID
private double gpa; // Unit 1 (Primitive Types): double for GPA
// Unit 5 (Writing Classes): Constructor for Student class
public Student(String name, int studentID, double gpa) {
this.name = name;
this.studentID = studentID;
this.gpa = gpa;
}
// Unit 5 (Writing Classes): Getters for Student attributes
public String getName() {
return name;
}
public int getStudentID() {
return studentID;
}
public double getGpa() {
return gpa;
}
// Unit 2 (Using Objects) & Unit 5 (Writing Classes): Overriding toString to display student info
@Override
public String toString() {
return "Student Name: " + name + ", ID: " + studentID + ", GPA: " + gpa;
}
}
public class StudentManagementSystem {
private ArrayList<Student> students; // Unit 7 (ArrayList): Using an ArrayList to store student records
public StudentManagementSystem() {
this.students = new ArrayList<>(); // Unit 7 (ArrayList): Initializing the ArrayList
}
// Unit 5 (Writing Classes): Method to add a new Student object to the system
public void addStudent(String name, int studentID, double gpa) {
// Unit 5 (Writing Classes): Creating a new instance of the Student class
Student newStudent = new Student(name, studentID, gpa);
// Unit 7 (ArrayList): Adding a student object to the ArrayList
students.add(newStudent);
}
// Unit 4 (Iteration): Using a loop to iterate through all students and display their details
public void displayStudents() {
for (Student student : students) { // Unit 4 (Iteration): Looping through students
System.out.println(student);
}
}
// Unit 3 (Boolean Expressions & if Statements): Searching for a student by ID
public Student searchStudentByID(int studentID) {
// Unit 4 (Iteration): Looping through the students to find the matching ID
for (Student student : students) {
if (student.getStudentID() == studentID) { // Unit 3 (Boolean Expressions): Checking if IDs match
return student; // If the student is found, return the student object
}
}
return null; // Unit 3 (Boolean Expressions): Return null if the student is not found
}
// Unit 4 (Iteration) & Unit 3 (Boolean Expressions): Using removeIf to delete a student by ID
public void deleteStudent(int studentID) {
// Unit 4 (Iteration): Iterating over students and removing the one with matching ID
students.removeIf(student -> student.getStudentID() == studentID); // Unit 3 (Boolean Expressions): Condition to remove student
}
// Unit 10 (Recursion): Recursively calculating the average GPA of all students
public double calculateAverageGPA(int index) {
// Unit 10 (Recursion): Base case: If we've reached the end of the list, return 0
if (index == students.size()) return 0;
// Unit 10 (Recursion): Recursive case: Add the current student's GPA and move to the next index
return students.get(index).getGpa() / students.size() + calculateAverageGPA(index + 1);
}
public static void main(String[] args) {
// Unit 2 (Using Objects): Creating an instance of the StudentManagementSystem class
StudentManagementSystem system = new StudentManagementSystem();
// Unit 2 (Using Objects): Using Scanner for input
Scanner input = new Scanner(System.in);
boolean exit = false; // Unit 3 (Boolean Expressions): Boolean flag for the exit condition
while (!exit) { // Unit 4 (Iteration): Loop to keep the menu active until the user decides to exit
// Displaying menu options
System.out.println("\n--- Menu ---");
System.out.println("1. Add Students");
System.out.println("2. Display All Students");
System.out.println("3. Search Student by ID");
System.out.println("4. Delete Student by ID");
System.out.println("5. Calculate Average GPA");
System.out.println("6. Exit");
System.out.print("Choose an option: ");
int choice = input.nextInt();
input.nextLine(); // Consume the newline character
if (choice == 1) {
// Adding students
System.out.print("How many students would you like to add? "); // Unit 3 (Boolean Expressions): Asking for input
int numStudents = input.nextInt();
input.nextLine(); // Consume the newline
for (int i = 0; i < numStudents; i++) { // Unit 4 (Iteration): Loop to add multiple students
System.out.println("Enter details for student " + (i + 1) + ":");
System.out.print("Name: ");
String name = input.nextLine();
System.out.print("Student ID: ");
int studentID = input.nextInt();
System.out.print("GPA: "); // Unit 1 (Primitive Types): Asking for a double value
double gpa = input.nextDouble();
input.nextLine(); // Consume the newline character
system.addStudent(name, studentID, gpa); // Unit 5 (Writing Classes): Adding student to the system
}
} else if (choice == 2) {
// Displaying all students
System.out.println("\nAll students:"); // Unit 4 (Iteration): Displaying student records
system.displayStudents();
} else if (choice == 3) {
// Searching for a student by ID
System.out.print("Enter Student ID to search: "); // Unit 3 (Boolean Expressions): Prompt for input
int searchID = input.nextInt();
Student foundStudent = system.searchStudentByID(searchID); // Unit 3 (Boolean Expressions): Search for the student
if (foundStudent != null) {
System.out.println("Student found: " + foundStudent); // Unit 3 (Boolean Expressions): If found, display info
} else {
System.out.println("Student with ID " + searchID + " not found."); // Unit 3 (Boolean Expressions): If not found
}
} else if (choice == 4) {
// Deleting a student by ID
System.out.print("Enter Student ID to delete: "); // Unit 3 (Boolean Expressions): Prompt for ID
int deleteID = input.nextInt();
system.deleteStudent(deleteID); // Unit 4 (Iteration): Deleting the student
System.out.println("Student with ID " + deleteID + " has been deleted.");
} else if (choice == 5) {
// Calculating average GPA
System.out.println("Average GPA: " + system.calculateAverageGPA(0)); // Unit 10 (Recursion): Displaying average GPA
} else if (choice == 6) {
// Exiting the program
exit = true; // Unit 3 (Boolean Expressions): Setting exit condition to true
System.out.println("Exiting the program. Goodbye!");
} else {
// Invalid input
System.out.println("Invalid choice. Please try again."); // Unit 3 (Boolean Expressions): Handling invalid input
}
}
input.close(); // Unit 2 (Using Objects): Closing the scanner
}
}
StudentManagementSystem.main(null);
--- Menu ---
1. Add Students
2. Display All Students
3. Search Student by ID
4. Delete Student by ID
5. Calculate Average GPA
6. Exit
Choose an option:
How many students would you like to add?
Enter details for student 1:
Name: Student ID: GPA:
Enter details for student 2:
Name: Student ID: GPA:
--- Menu ---
1. Add Students
2. Display All Students
3. Search Student by ID
4. Delete Student by ID
5. Calculate Average GPA
6. Exit
Choose an option:
All students:
Student Name: Nitin Balaji, ID: 1907892, GPA: 4.0
Student Name: Srinivas Nampalli, ID: 1945873, GPA: 3.75
--- Menu ---
1. Add Students
2. Display All Students
3. Search Student by ID
4. Delete Student by ID
5. Calculate Average GPA
6. Exit
Choose an option:
Average GPA: 3.875
--- Menu ---
1. Add Students
2. Display All Students
3. Search Student by ID
4. Delete Student by ID
5. Calculate Average GPA
6. Exit
Choose an option:
Enter Student ID to search:
Student found: Student Name: Nitin Balaji, ID: 1907892, GPA: 4.0
--- Menu ---
1. Add Students
2. Display All Students
3. Search Student by ID
4. Delete Student by ID
5. Calculate Average GPA
6. Exit
Choose an option:
Enter Student ID to delete: Student with ID 1907892 has been deleted.
--- Menu ---
1. Add Students
2. Display All Students
3. Search Student by ID
4. Delete Student by ID
5. Calculate Average GPA
6. Exit
Choose an option:
All students:
Student Name: Srinivas Nampalli, ID: 1945873, GPA: 3.75
--- Menu ---
1. Add Students
2. Display All Students
3. Search Student by ID
4. Delete Student by ID
5. Calculate Average GPA
6. Exit
Choose an option:
How many students would you like to add?
Enter details for student 1:
Name: Student ID: GPA:
--- Menu ---
1. Add Students
2. Display All Students
3. Search Student by ID
4. Delete Student by ID
5. Calculate Average GPA
6. Exit
Choose an option:
Average GPA: 3.875
--- Menu ---
1. Add Students
2. Display All Students
3. Search Student by ID
4. Delete Student by ID
5. Calculate Average GPA
6. Exit
Choose an option:
Exiting the program. Goodbye!
Unit 1: Primitive Types
- Attributes of the
Student
class:int
forstudentID
double
forgpa
- These data types are basic building blocks in Java, representing integer and floating-point numbers.
Unit 2: Using Objects
- String for the
name
attribute:String
is a class that represents textual data.
- Using
Scanner
:- A
Scanner
object is used for user input.
- A
- Creating Objects:
StudentManagementSystem
andStudent
objects are instantiated to manage and store student data.
Unit 3: Boolean Expressions and if Statements
- Searching and Deleting Students by ID:
- Uses
if
statements to check if a student’sstudentID
matches the input, and to verify valid choices in the menu. - Boolean expressions evaluate equality in conditions like
student.getStudentID() == studentID
.
- Uses
Unit 4: Iteration
- Displaying, Searching, and Deleting Students:
for-each
loop is used to iterate through theArrayList
of students.- The
removeIf()
method, combined with a lambda expression, iterates over the list to remove a student. - Iteration also occurs in the menu to continuously prompt the user for input until they choose to exit.
Unit 5: Writing Classes
Student
Class:- Contains attributes (
name
,studentID
,gpa
), a constructor, and methods likegetName()
,getStudentID()
, andgetGpa()
. - This encapsulation allows you to work with student data in a well-organized way.
- Contains attributes (
- Overriding
toString()
:- The
toString()
method inStudent
is overridden to provide a readable string representation of a student’s information.
- The
Unit 7: ArrayList
- Storing Student Objects:
- An
ArrayList<Student>
is used to dynamically store and manage the list of students, providing flexibility in terms of adding, searching, and removing students.
- An
Unit 10: Recursion
- Calculating Average GPA:
- A recursive method,
calculateAverageGPA(int index)
, computes the average GPA by adding the GPA of each student and dividing by the total number of students. - This demonstrates the use of recursion to break down a complex problem into simpler, smaller steps.
- A recursive method,
CSA Unit 1-10 Study Guide
Unit 1: Primitive Types
Link to hacks: Unit 1 Hacks
- Key Concepts:
- Variables: Containers that store data values.
- Primitive Data Types:
int
(whole numbers),double
(decimals),boolean
(true/false),char
(single characters). - Arithmetic Operators:
+
,-
,*
,/
,%
for basic calculations. - Casting: Converting one data type to another, like converting a
double
to anint
.
Real-life Example: In a banking system, primitive types can store account balances and interest rates:
double accountBalance = 1050.75;
int transactions = 5;
boolean isActive = true;
Unit 2: Using Objects
Link to hacks: Unit 2 Hacks
- Key Concepts:
- Classes and Objects: A class is a blueprint for creating objects. Objects are instances of classes.
- Methods: Blocks of code that perform actions. Methods belong to objects or classes.
- Constructors: Special methods used to initialize objects when they are created.
- String Class: A pre-defined Java class used to work with sequences of characters.
- Scanner Class: Used for user input from the console.
Real-life Example: In an online form, objects of the String
class store user-provided names and email addresses, and the Scanner
class collects that input:
Scanner input = new Scanner(System.in);
System.out.print("Enter your name: ");
String name = input.nextLine();
Unit 3: Boolean Expressions and if Statements
Link to hacks: Unit 3 Hacks
- Key Concepts:
- Boolean Expressions: Expressions that evaluate to either
true
orfalse
, using relational (==
,!=
,>
,<
, etc.) and logical (&&
,||
,!
) operators. - if-else Statements: Control flow based on conditions. If a condition is true, a block of code is executed; otherwise, another block can be executed.
- else if: Provides additional conditions to check if the first one is false.
- Boolean Expressions: Expressions that evaluate to either
Real-life Example: A website checks if a user is logged in or not before granting access to restricted content:
boolean isLoggedIn = true;
if (isLoggedIn) {
System.out.println("Access granted");
} else {
System.out.println("Please log in.");
}
Unit 4: Iteration
Link to hacks: Unit 4 Hacks
- Key Concepts:
for
Loop: A loop that repeats a block of code a specific number of times.while
Loop: A loop that repeats a block of code as long as a condition is true.do-while
Loop: Similar towhile
loop but guarantees the code runs at least once.- Enhanced
for
Loop: Also known as a for-each loop, used to iterate over arrays or collections.
Real-life Example: Looping through a list of email addresses to send out a newsletter:
String[] emails = {"alice@gmail.com", "bob@gmail.com", "charlie@gmail.com"};
for (String email : emails) {
System.out.println("Sending newsletter to " + email);
}
Unit 5: Writing Classes
Link to hacks: Unit 5 Hacks
- Key Concepts:
- Class Definitions: Defining a new class with attributes (variables) and methods (functions) that belong to that class.
- Instance Variables: Attributes that belong to an object (i.e., the state of the object).
- Methods: Functions that define behavior for objects, such as getters/setters.
- Constructors: Special methods used to create new objects and initialize their attributes.
- Encapsulation: Using
private
to hide an object’s internal data and usingpublic
methods to provide controlled access.
Real-life Example: A Book
class in a library system:
class Book {
private String title;
private String author;
// Constructor
public Book(String title, String author) {
this.title = title;
this.author = author;
}
// Method to display book details
public void displayDetails() {
System.out.println("Title: " + title + ", Author: " + author);
}
}
Unit 6: Array
Link to hacks: Unit 6 Hacks
- Key Concepts:
- Array Declaration and Initialization: Arrays store a fixed number of elements of the same type.
- Accessing Elements: Use an index to retrieve or modify elements.
- Traversing Arrays: Using loops to iterate through array elements.
- 2D Arrays: Arrays of arrays, used for grid-like structures.
Real-life Example: Storing temperatures for a week:
double[] weeklyTemps = {72.3, 73.5, 75.2, 71.8, 68.9, 70.4, 69.5};
for (int i = 0; i < weeklyTemps.length; i++) {
System.out.println("Day " + (i + 1) + ": " + weeklyTemps[i] + "°F");
}
Unit 7: ArrayList
Link to hacks: Unit 7 Hacks
- Key Concepts:
- ArrayList Declaration: A flexible, dynamic list that can grow or shrink.
- Adding and Removing Elements: Add elements to an
ArrayList
without worrying about size limitations. - Iteration over ArrayLists: Use loops to access elements in an
ArrayList
. - ArrayList Methods: Methods like
.add()
,.remove()
,.size()
,.get()
, and.contains()
.
Real-life Example: Managing a dynamic list of customer names in a store’s rewards program:
import java.util.ArrayList;
ArrayList<String> customers = new ArrayList<>();
customers.add("Alice");
customers.add("Bob");
customers.remove("Alice");
System.out.println(customers.size()); // Outputs: 1
Unit 8: 2D Array
Link to hacks: Unit 8 Hacks
- Key Concepts:
- 2D Array Declaration: Arrays with rows and columns, like a table or grid.
- Accessing Elements: Use two indices, one for the row and one for the column.
- Traversing 2D Arrays: Using nested loops to process each element.
Real-life Example: Creating a seating chart in a classroom:
String[][] seatingChart = {
{"Alice", "Bob", "Charlie"},
{"David", "Eve", "Frank"}
};
System.out.println("Student at position (0,1): " + seatingChart[0][1]); // Outputs: Bob
Unit 9: Inheritance
Link to hacks: Unit 9 Hacks
- Key Concepts:
- Inheritance: Allows one class (subclass) to inherit attributes and methods from another class (superclass).
- Superclass and Subclass: The superclass provides the basic structure, while the subclass extends or modifies it.
- Method Overriding: A subclass can provide a specific implementation of a method defined in its superclass.
- Polymorphism: The ability of objects to take on many forms, typically referring to a superclass reference pointing to a subclass object.
Real-life Example: A Car
superclass and a SportsCar
subclass:
class Car {
String make;
String model;
public void start() {
System.out.println("Car started.");
}
}
class SportsCar extends Car {
boolean turboCharged;
@Override
public void start() {
System.out.println("Sports car started with turbo mode!");
}
}
Unit 10: Recursion
- Key Concepts:
- Recursion: A method calls itself to solve smaller instances of a problem.
- Base Case: The condition under which the recursion stops.
- Recursive Case: The part of the method where it calls itself to continue solving the problem.
- Stack Overflow: If recursion is too deep without a proper base case, the system runs out of memory.
Real-life Example: Finding the factorial of a number (used in probability and statistics):
public int factorial(int n) {
if (n == 1) return 1; // Base case
return n * factorial(n - 1); // Recursive case
}