This is a 10-part code-along project to build a console-based school attendance system in Java.
- Verified Java and Git setup.
- Initialized Git repository for the project.
- Created basic project structure with
Main.java. - Compiled and ran the initial "Welcome" program.
- Pushed initial setup to a
part-01branch on GitHub and created a PR.
-
Navigate to the project root directory (
AttendanceSystem). -
Compile:
javac src/com/school/Main.java -
Run:
java -cp src com.school.Main
- Defined
Studentclass withstudentId,name,setDetails(), anddisplayDetails()method. - Defined
Courseclass withcourseId,courseName,setDetails(), anddisplayDetails()method. - Utilized arrays of objects in
Main.javato manage and display multiple students and courses. - Introduced basic usage of
thiskeyword.
- Navigate to the project root directory.
- Compile:
javac src/com/school/Student.java src/com/school/Course.java src/com/school/Main.java(orjavac src/com/school/*.java) - Run:
java -cp src com.school.Main
- Implemented parameterized constructors in
StudentandCourseclasses for object initialization. - Utilized
private staticmember variables for automatic and unique ID generation. - Student IDs start from 1 and auto-increment (1, 2, 3, 4...)
- Course IDs start from 101 and auto-increment with "C" prefix (C101, C102, C103...)
- Demonstrated the use of the
thiskeyword to distinguish instance variables from constructor parameters. - Changed
Course'scourseIdtointfor simpler auto-generation and updated its display. - Updated
Main.javato use constructors and show ID progression with multiple instances. - Removed
setDetails()methods as constructors now handle initialization.
- Navigate to the project root directory.
- Compile:
javac src/com/school/*.java(compiles all Java files in the directory) - Run:
java -cp src com.school.Main
- Applied encapsulation to
StudentandCourseclasses by making fieldsprivateand adding publicgetters. - Introduced a new
AttendanceRecordclass withprivatefields, a constructor, andgettersto store attendance data. - Implemented basic validation in the
AttendanceRecordconstructor for the attendance status (allowing only "Present" or "Absent"). - Used an
ArrayListinMain.javato store and displayAttendanceRecordobjects. - Demonstrated retrieving IDs using getters (e.g.,
student1.getStudentId()) when creating records.
- Navigate to the project root directory.
- Compile:
javac src/com/school/*.java(or list individual files includingAttendanceRecord.java) - Run:
java -cp src com.school.Main