Skip to content

kalviumcommunity/Varsha_S62_AttendanceSystem

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Attendance system

Session 2: Core Domain Modelling

  • Defined Student class with studentId, name, setDetails(), and displayDetails() method.
  • Defined Course class with courseId, courseName, setDetails(), and displayDetails() method.
  • Utilized arrays of objects in Main.java to manage and display multiple students and courses.
  • Introduced basic usage of this keyword.

How to Run

  1. Navigate to the project root directory.
  2. Compile: javac src/com/school/Student.java src/com/school/Course.java src/com/school/Main.java (or javac src/com/school/*.java)
  3. Run: java -cp src com.school.Main

Part 3: Constructor Initialization & Auto-ID Generation

  • Implemented parameterized constructors in Student and Course classes for object initialization.
  • Utilized private static member variables for automatic and unique ID generation.
  • Demonstrated the use of the this keyword to distinguish instance variables from constructor parameters.
  • Changed Course's courseId to int for simpler auto-generation and updated its display.
  • Updated Main.java to use constructors and show ID progression.

How to Run (ensure this is up-to-date)

  1. Navigate to the project root directory.
  2. Compile: javac src/com/school/Student.java src/com/school/Course.java src/com/school/Main.java (or javac src/com/school/*.java)
  3. Run: java -cp src com.school.Main

Part 4: Data Encapsulation & Attendance Recording Validation

  • Applied encapsulation to Student and Course classes by making fields private and adding public getters.
  • Introduced a new AttendanceRecord class with private fields, a constructor, and getters to store attendance data.
  • Implemented basic validation in the AttendanceRecord constructor for the attendance status (allowing only "Present" or "Absent").
  • Used an ArrayList in Main.java to store and display AttendanceRecord objects.
  • Demonstrated retrieving IDs using getters (e.g., student1.getStudentId()) when creating records.

How to Run

  1. Navigate to the project root directory.
  2. Compile: javac src/com/school/*.java (or list individual files including AttendanceRecord.java)
  3. Run: java -cp src com.school.Main

Part 5: Establishing Students, Teaching & Non-Teaching Staff hierarchy

  • Created a base class Person.java with common attributes (id, name), a universal auto-ID generator, and a displayDetails() method.
  • Modified Student.java to inherit from Person, using super() to call the parent constructor and overriding displayDetails() to add student-specific info (e.g., grade level).
  • Created Teacher.java extending Person, adding a subjectTaught attribute and its own displayDetails().
  • Created Staff.java extending Person, adding a role attribute and its own displayDetails().
  • Demonstrated creation and display of Student, Teacher, and Staff objects in Main.java.
  • Updated AttendanceRecord creation to use the inherited getId() method.

Part 6: Interface-Driven Persistence with Storage

  • Defined a Storable interface with a toDataString() method.
  • Modified Student, Course, and AttendanceRecord classes to implement the Storable interface and provide their specific toDataString() implementations (CSV format).
  • Created a FileStorageService class with a saveData(List<? extends Storable> items, String filename) method to write Storable objects to a text file.
  • Utilized try-with-resources for safe file handling (PrintWriter, FileWriter).
  • Demonstrated in Main.java how to save lists of students, courses, and attendance records to separate files (students.txt, courses.txt, attendance_log.txt).
  • Discussed the flexibility provided by interfaces for handling different types of storable objects uniformly.

How to Run

  1. Navigate to the project root directory.
  2. Compile: javac src/com/school/*.java
  3. Run: java -cp src com.school.Main
  4. Check the generated files: students.txt, courses.txt, attendance_log.txt.

About

This is your first repository

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages