Question
Please help me write the program below in c++ Define a class called Student. The class will have the following attributesand methods. Attributes(all need to
Please help me write the program below in c++
Define a class called Student.
The class will have the following attributesand methods.
Attributes(all need to be set to private)
id(should be a constant)
first name
last name
major
gpa
Constructors ... 2 overloaded
1) without any parameters
2) second constructor with all 5 attributes as parameters
Behaviors(set all to public)
appropriate getters and setters
findStudent(int id)
listStudents(double gpa)
listStudents(string major)
Files:
Student.h //Definition of the Student class
Student.cpp //Implementation of the Student class
Client.cpp //Contains the main() method, through which the various Student objects will be created and tested.
ToDo:
- Create 5 Student objects; both of the constructors should be used at least once,
Id's: 1001, 1002, 1003, 1004 and 1005
Names and gpa can be at your discetion
Majors can be assigned from: Biology, Computer Science, Education, Engineering, History, Mathematics
- Set up a loop to display the information(values of attributes) of all 5 objects.
- Change the major of two of the Students objects. Display the change.
- Change the gpa of two other Student objects. Display the change.
- Test the findStudent() method by passing a valid id value. Display the appropriate message.
- Test the findStudent() method by passing an invalid(non - existing) id value. Display the appropriate message.
- Test both of the listStudents() methods
+ Pass a double value and list all students whose gpa is above the passed value.
+ Pass a string, and list all students whose major equals the passed value.
+ In either, display the appropriate message ... either found or not found.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started