[Periodicals 2] Simple Student Management System
Problem Definition
You are asked to create a program that simulates a Simple Student Management System. The system should allow the user to perform various operations on a list of students using a menu-driven interface. The program should utilize structs, enums, and menu-driven programming. Your task is to design and implement the program according to the following specifications:
Define the following structures:
Student
: Contains the following attributes:name
(a string to store the student's name)age
(an integer to store the student's age)score
(an enum representing the student's score)
Define an enum for the student scores:
A
: Represents an excellent score.B
: Represents a good score.C
: Represents an average score.D
: Represents a below-average score.F
: Represents a failing score.
Implement a menu-driven program that offers the following options:
Option 1: Add a student
- Prompt the user to enter the details of a student (name, age, and score).
- Create a new
Student
struct. - Store the entered details in the new
Student
struct. - Add the new student to the list of students.
Option 2: Display all students
- Iterate through the list of students and display their details.
- If the list is empty, display a message indicating no students to display.
Option 3: Find the highest-scoring student
- Iterate through the list of students and find the student with the highest score.
- Display the details of the student with the highest score.
- If the list is empty, display a message indicating no students.
Option 4: Exit the program
- Display an exit message.
Implement the necessary functions to fulfill the requirements of the program:
addStudent
: Accepts the list of students as parameter, and adds a new student.displayStudents
: Accepts the list of students as parameter, and displays the details of all the students.findHighestScoringStudent
: Accepts the list of students as parameter, and returns the student's index with the highest score.- Constant Macro
MAX_STUDENTS
set to 3. If the count of students reachesMAX_STUDENTS
, then accordingly print the error message.
Implement a main
function that:
- Creates an array of
Student
structs with a maximum capacity (MAX_STUDENTS
). - Tracks the count of students in the list.
- Calls the appropriate functions based on the user's menu selection.
Ensure that your program adheres to good coding practices, such as proper function prototypes, indentation, and meaningful variable names. Test your program thoroughly to ensure correct functionality and handle different scenarios.
Remember to manage your time effectively, including testing and debugging your code. Best of luck!
Test Data
Input 1
1
Ramaguru
33
A
4
Output 1
Student added successfully.
Exiting the program. Thank you for using our system!
Input 2
1
Ramaguru
33
A
1
Feroz
23
A
1
Harika
23
B
2
4
Output 2
Student added successfully.
Student added successfully.
Student added successfully.
List of students:
Student 1
Name: Ramaguru
Age: 33
Score: A
Student 2
Name: Feroz
Age: 23
Score: A
Student 3
Name: Harika
Age: 23
Score: B
Exiting the program. Thank you for using our system!
Input 3
1
Ramaguru
33
A
1
Feroz
23
A
1
Harika
23
B
3
4
Output 3
Student added successfully.
Student added successfully.
Student added successfully.
Highest-scoring student:
Name: Ramaguru
Age: 33
Score: A
Exiting the program. Thank you for using our system!
Input 4
1
Ramaguru
33
A
1
Feroz
23
A
1
Harika
23
B
1
4
Output 4
Student added successfully.
Student added successfully.
Student added successfully.
Maximum number of students reached.
Exiting the program. Thank you for using our system!
Input 5
1
Ramaguru
33
A
1
Feroz
23
A
1
Harika
23
B
2
3
4
Output 5
Student added successfully.
Student added successfully.
Student added successfully.
List of students:
Student 1
Name: Ramaguru
Age: 33
Score: A
Student 2
Name: Feroz
Age: 23
Score: A
Student 3
Name: Harika
Age: 23
Score: B
Highest-scoring student:
Name: Ramaguru
Age: 33
Score: A
Exiting the program. Thank you for using our system!
Comments