Question: / * TODO: Test 3 - Insert into collection * = = = = = = = = = = = = = = =
TODO: Test
Insert into collection
Given a student object, enrolled, and a vector of students,
search the students vector to find an open space. If an
opening is located, place the enrolled student into that
position and return true. If no openings are found, return
false
Tips:
An open space is identified by locating a space with a "default"
student.
Default students will always have an ID number of
As this a boolean true, the value displayed in the console may not
accurately represent your points for this test.
static bool Test
vector students, Student enrolled
return false;
TODO: Test
Remove from collection
Given an integer idNumber and a vector of students,
search the students vector for a student whose ID number
matches the idNumber parameter. If the ID number is found
replace the student in that position with a student created
using the default constructor and return true. If no student
with the given ID number is found, return false.
Tips:
As this a boolean true, the value displayed in the console may not
accurately represent your points for this test.
static bool Test
int idNumber, vector students
return false;
TODO: Test
Retrieve from collection
Given an integer idNumber and a vector of students,
search the students vector for the first student whose ID number
matches the idNumber parameter. If the ID number is found,
return the student with that ID number. If no student with
that ID number is found, return a student created with the
default constructor.
Tips:
Given the nature of the returned result, the value displayed
in the console may not accurately represent your points for
this test.
static Student Test
int idNumber, vector students
return
;
class Student
private:
string lastName;
string firstName;
int idNumber;
public:
Default constructor
Student
lastName
;
firstName
;
idNumber
;
Overloaded Constructor
Student
string last, string first, int idNo
lastName
last;
firstName
first;
idNumber
idNo;
Getters
string GetLastName
return lastName;
string GetFirstName
return firstName;
int GetIDNumber
return idNumber;
Setters
void SetLastName
string last
lastName
last;
void SetFirstName
string first
firstName
first;
void SetIDNumber
int idNo
idNumber
idNo;
CAN
T USE MULTIPLE RETURN METHODS PER TEST NUMBER
CAN
T USE AUTO
&auto
CPP only
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
