# Redovalnica - Student Grade Management System Package redovalnica implements a simple grade book in Go. ## Description A minimal grading system: add students and grades, list grades, and compute final results. Configurable thresholds control required grade counts and the grading range. ## Installation ```bash go get git.fri.uni-lj.si/zs7976/ps-naloga5 ``` ## Package Structure ``` naloga5/ ├── redovalnica/ # Core package with grading functionality │ └── redovalnica.go ├── cmd/ # Command-line application │ └── redovalnica.go ├── go.mod ├── go.sum └── README.md ``` ## Exported Functions The `redovalnica` package exports the following functions: ### DodajStudenta ```go func DodajStudenta(studenti map[string]Student, vpisnaStevilka string, ime string, priimek string) ``` Adds a new student to the grade book. If a student with the given ID already exists, the function does nothing. ### DodajOceno ```go func DodajOceno(studenti map[string]Student, vpisnaStevilka string, ocena int) ``` Adds a grade to a student's record. If the student doesn't exist, the function does nothing. ### IzpisVsehOcen ```go func IzpisVsehOcen(studenti map[string]Student) ``` Prints all students and their grades to standard output. ### IzpisiKoncniUspeh ```go func IzpisiKoncniUspeh(studenti map[string]Student, minStOcen int, minOcena int, maxOcena int) ``` Prints the final success status for all students based on their average grades and configured parameters. ## Usage as a Library ```go package main import ( "git.fri.uni-lj.si/zs7976/ps-naloga5/redovalnica" ) func main() { // Create student map studenti := make(map[string]redovalnica.Student) // Add students redovalnica.DodajStudenta(studenti, "63210001", "Ana", "Novak") redovalnica.DodajStudenta(studenti, "63210002", "Boris", "Kralj") // Add grades redovalnica.DodajOceno(studenti, "63210001", 10) redovalnica.DodajOceno(studenti, "63210001", 9) redovalnica.DodajOceno(studenti, "63210001", 8) redovalnica.DodajOceno(studenti, "63210002", 6) redovalnica.DodajOceno(studenti, "63210002", 7) // Display all grades redovalnica.IzpisVsehOcen(studenti) // Display final success (minStOcen=3, minOcena=1, maxOcena=10) redovalnica.IzpisiKoncniUspeh(studenti, 3, 1, 10) } ``` ## Command-Line Application The package includes a command-line application with configurable parameters. ### Building ```bash cd cmd go build -o redovalnica ``` ### Running ```bash # Run with default parameters ./redovalnica # Run with custom parameters ./redovalnica --stOcen 4 --minOcena 5 --maxOcena 10 ``` ### Command-Line Flags - `--stOcen`: Minimum number of grades required for positive evaluation (default: 3) - `--minOcena`: Minimum possible grade (default: 1) - `--maxOcena`: Maximum possible grade (default: 10) ### Example Output ``` === Sistem Redovalnica === Parametri: minStOcen=3, minOcena=1, maxOcena=10 REDOVALNICA: 63210001 - Ana Novak: [10 9 8] 63210002 - Boris Kralj: [6 7 5 8] 63210003 - Janez Novak: [4 5] Ana Novak: povprečna ocena 9.0 (3 ocen) -> Odličen študent! Boris Kralj: povprečna ocena 6.5 (4 ocen) -> Povprečen študent Janez Novak: povprečna ocena 4.5 (2 ocen) -> Premalo ocen ``` ## Internal functions Unexported helpers: - `povprecje`: average grade for a student - `izpisStudenta`: format student info - `vrniUspeh`: determine success category ## Documentation For detailed API documentation, run: ```bash go doc git.fri.uni-lj.si/zs7976/ps-naloga5/redovalnica ``` Or view documentation for specific functions: ```bash go doc git.fri.uni-lj.si/zs7976/ps-naloga5/redovalnica.DodajOceno go doc git.fri.uni-lj.si/zs7976/ps-naloga5/redovalnica.IzpisVsehOcen ``` ## Author Žan Skvarča