Introduction
In this challenge, you are tasked with designing a robust and secure student management class in C++ to help schools efficiently manage student information in the digital age. The goal is to create a Student class with private data members for name, age, and GPA, and implement public setter methods to set and display student information.
Design a Student Management System
In the digital age, schools need efficient ways to manage student information. Your task is to create a robust and secure student management class in C++.
Tasks
- Create a
Studentclass with private data members forname,age, andgpa - Implement public setter methods to set student information
- Create a public method to display student information
Requirements
Create a
Studentclass with private data membersname(string),age(int), andgpa(double).Implement a
setNamemethod that accepts a string parameter and validates the name is not empty.Implement a
setAgemethod that accepts an integer parameter and validates age is between 0-120.Implement a
setGPAmethod that accepts a double parameter and validates GPA is between 0.0-4.0.Create a
displayInfomethod that prints student information in this format:Student Name: <name> Student Age: <age> Student GPA: <gpa>Save the implementation in
~/project/student.cppfile.Include the required headers
<iostream>and<string>.
Examples
Run the program to test your implementation:
g++ student.cpp -o student
./student
Example output of the program:
Student Name: Alice Johnson
Student Age: 20
Student GPA: 3.75
Hints
- Use private access specifier for data members
- Create setter methods with appropriate parameter validation
- Use
std::stringfor name - Implement input validation for age and GPA ranges
Summary
In summary, this challenge requires you to design a student management class in C++ that can efficiently store and display student information, including name, age, and GPA. You will need to implement private data members and public setter methods to meet the specified requirements, such as using std::string for name, int for age, and double for GPA. The final implementation should be saved in the ~/project/student.cpp file.



