SlideShare a Scribd company logo
Header
#include <string>
#include <vector>
#include <iostream>
using namespace std;
enum Gender {
MALE,
FEMALE
};
class Student{
private:
long id; // Unique ID
string name; // Name of student
Gender gender; // Gender of student
string courseCode; // Course code (CIIC or ICOM)
double gpa; // GPA of student
public:
Student(long id, const string &name, Gender gender, double gpa){
this->id = id;
this->name = name;
this->gender = gender;
this->courseCode = "";
this->gpa = gpa;
}
Student(long id, const string &name, Gender gender, string courseCode, double gpa){
this->id = id;
this->name = name;
this->gender = gender;
this->courseCode = courseCode;
this->gpa = gpa;
}
Student(){}
static string toString(Student& s){
string genderLetter = (s.gender == MALE ? "M" : "F");
return string("{" + to_string(s.id) + "," + s.name + "," + genderLetter + "," + to_string(s.gpa) +
"}");
}
static string toString(vector<Student>& v){
string result = "{";
for (Student s : v) {
result += toString(s) + ",";
}
result += "}";
return result;
}
static string toString(vector<long>& v){
string result = "{";
for (long id : v) {
result += to_string(id) + ",";
}
result += "}";
return result;
}
// Getters
long getID() const {return id;}
string getName() const {return name;}
Gender getGender() const {return gender;}
double getGPA() const {return gpa;}
string getCourseCode() const {return courseCode;}
//Setters
void setName(string name){this->name = name;}
void setGender(Gender gender){this->gender = gender;}
void setGPA(double gpa){this->gpa = gpa;}
void setCourseCode(string code){this->courseCode = code;}
// EXERCISES
static double maxStudentGPA(vector<Student>& v);
static double minStudentGPA(vector<Student>& v);
static double averageGPA(vector<Student> &v, int N);
static vector<long> countStudents(vector<Student>& v, string code);
static void removeByID(vector<Student> &v, long ID);
static void updateStudent(vector<Student> &v, const Student &s);
static vector<Student> findStudents(vector<Student>& v, float gpa);
static vector<Student> repeatedStudentNames(vector<Student>& v);
};
Cpp file
#include "Student.h"
using namespace std;
/*
* EXERCISE: #1A
*
* IMPLEMENT USING AN ENHANCED FOR LOOP (ForEach).
*
* Returns the highest GPA value possessed by any Student in the given list.
*
*/
double Student::maxStudentGPA(vector<Student>& v)
{
//YOUR CODE HERE
return -99.9; //DUMMY RETURN
}
/*
* EXERCISE: #1B
*
* IMPLEMENT USING A REGULAR FOR LOOP.
*
* Returns the lowest GPA value possessed by any Student in the given list.
*
*/
double Student::minStudentGPA(vector<Student>& v)
{
//YOUR CODE HERE
return -99.9; //DUMMY RETURN
}
/*
* Exercise #1C
*
* IMPLEMENT USING A WHILE LOOP
*
* For the first N students, calculate the average gpa
*
* Formula: average = sum / N
* Assume N is greater than 0
*/
double Student::averageGPA(vector<Student> &v, int N){
//YOUR CODE HERE
return -99.9; //DUMMY RETURN
}
/**
*
* EXERCISE #2
*
* IMPLEMENT IT USING AN ENHANCED FOR LOOP (ForEach)
*
* Given a course code, you must return a vector that contains
* only the unique ID of the Students that have that particular course code.
*/
vector<long> Student::countStudents(vector<Student>& v, string code){
vector<long> result;
//YOUR CODE HERE
return result;
}
/*
* EXERCISE #3
*
* IMPLEMENT USING A DO...WHILE LOOP
*
* Return a vector that contains all the Students that have a GPA greater
* or equal to the GPA passed as the parameter
*
* Assume the list contains at least one element
*/
vector<Student> Student::findStudents(vector<Student>& v, float gpa){
//YOU CODE HERE
return v;
}
/*
* EXERCISE: #4
*
* IMPLEMENT WITH ANY LOOP
*
* Removes the first occurrence of the specified Student ID,
* if it is present. If not present, then list is unchanged.
*
* HINT: Verify the methods erase() and begin() of the vector
*/
void Student::removeByID(vector<Student> &v, long ID){
//YOUR CODE HERE
}
/*
* EXERCISE #5
*
* DO NOT USE WHILE LOOPS
*
* Find the Student record that matches the given Student
* and update its data. If the Student is not present, add it to the list.
*
* Remember that each Student has an unique identifier
*/
void Student::updateStudent(vector<Student> &v, const Student &s){
//YOUR CODE HERE
}
/*
* BONUS
*
* IMPLEMENT WITH NESTED LOOPS USING ANY LOOP.
*
* Returns a vector cointaining two Students that has the same name.
* If there is no repeated names, the vector stays empty.
*
* HINT: Use the compare method of the string library
*/
vector<Student> Student::repeatedStudentNames(vector<Student>& v){
//YOUR CODE HERE
return v;
}

More Related Content

Similar to Header #include -string- #include -vector- #include -iostream- using.pdf

Starting with Main.java, where I tested everythingimport College..pdf
Starting with Main.java, where I tested everythingimport College..pdfStarting with Main.java, where I tested everythingimport College..pdf
Starting with Main.java, where I tested everythingimport College..pdf
aptind
 
public class Person { private String name; private int age;.pdf
public class Person { private String name; private int age;.pdfpublic class Person { private String name; private int age;.pdf
public class Person { private String name; private int age;.pdf
arjuncp10
 
Answer using basic programming beginner knowledge pls...........Othe.pdf
Answer using basic programming beginner knowledge pls...........Othe.pdfAnswer using basic programming beginner knowledge pls...........Othe.pdf
Answer using basic programming beginner knowledge pls...........Othe.pdf
suresh640714
 
OOP Lab Report.docx
OOP Lab Report.docxOOP Lab Report.docx
OOP Lab Report.docx
ArafatSahinAfridi
 
Hello. Im currently working on the last section to my assignment a.pdf
Hello. Im currently working on the last section to my assignment a.pdfHello. Im currently working on the last section to my assignment a.pdf
Hello. Im currently working on the last section to my assignment a.pdf
irshadkumar3
 
Program: Inheritance in Class - to find topper out of 10 students
Program: Inheritance in Class - to find topper out of 10 studentsProgram: Inheritance in Class - to find topper out of 10 students
Program: Inheritance in Class - to find topper out of 10 students
Swarup Boro
 
In Java- Create a Graduate class derived from Student- A graduate has.pdf
In Java- Create a Graduate class derived from Student- A graduate has.pdfIn Java- Create a Graduate class derived from Student- A graduate has.pdf
In Java- Create a Graduate class derived from Student- A graduate has.pdf
Stewart29UReesa
 
Computer programming 2 -lesson 4
Computer programming 2  -lesson 4Computer programming 2  -lesson 4
Computer programming 2 -lesson 4
MLG College of Learning, Inc
 
Programming in C#Define an application to include classes for Stud.pdf
Programming in C#Define an application to include classes for Stud.pdfProgramming in C#Define an application to include classes for Stud.pdf
Programming in C#Define an application to include classes for Stud.pdf
fashionscollect
 
Schema Refinement And Normal Forms Changes That Occurred Since.pdf
Schema Refinement And Normal Forms Changes That Occurred Since.pdfSchema Refinement And Normal Forms Changes That Occurred Since.pdf
Schema Refinement And Normal Forms Changes That Occurred Since.pdf
sdfghj21
 
How to implement g rpc services in nodejs
How to implement g rpc services in nodejsHow to implement g rpc services in nodejs
How to implement g rpc services in nodejs
Katy Slemon
 

Similar to Header #include -string- #include -vector- #include -iostream- using.pdf (12)

Starting with Main.java, where I tested everythingimport College..pdf
Starting with Main.java, where I tested everythingimport College..pdfStarting with Main.java, where I tested everythingimport College..pdf
Starting with Main.java, where I tested everythingimport College..pdf
 
public class Person { private String name; private int age;.pdf
public class Person { private String name; private int age;.pdfpublic class Person { private String name; private int age;.pdf
public class Person { private String name; private int age;.pdf
 
Answer using basic programming beginner knowledge pls...........Othe.pdf
Answer using basic programming beginner knowledge pls...........Othe.pdfAnswer using basic programming beginner knowledge pls...........Othe.pdf
Answer using basic programming beginner knowledge pls...........Othe.pdf
 
OOP Lab Report.docx
OOP Lab Report.docxOOP Lab Report.docx
OOP Lab Report.docx
 
Hello. Im currently working on the last section to my assignment a.pdf
Hello. Im currently working on the last section to my assignment a.pdfHello. Im currently working on the last section to my assignment a.pdf
Hello. Im currently working on the last section to my assignment a.pdf
 
Program: Inheritance in Class - to find topper out of 10 students
Program: Inheritance in Class - to find topper out of 10 studentsProgram: Inheritance in Class - to find topper out of 10 students
Program: Inheritance in Class - to find topper out of 10 students
 
In Java- Create a Graduate class derived from Student- A graduate has.pdf
In Java- Create a Graduate class derived from Student- A graduate has.pdfIn Java- Create a Graduate class derived from Student- A graduate has.pdf
In Java- Create a Graduate class derived from Student- A graduate has.pdf
 
Computer programming 2 -lesson 4
Computer programming 2  -lesson 4Computer programming 2  -lesson 4
Computer programming 2 -lesson 4
 
Programming in C#Define an application to include classes for Stud.pdf
Programming in C#Define an application to include classes for Stud.pdfProgramming in C#Define an application to include classes for Stud.pdf
Programming in C#Define an application to include classes for Stud.pdf
 
Schema Refinement And Normal Forms Changes That Occurred Since.pdf
Schema Refinement And Normal Forms Changes That Occurred Since.pdfSchema Refinement And Normal Forms Changes That Occurred Since.pdf
Schema Refinement And Normal Forms Changes That Occurred Since.pdf
 
How to implement g rpc services in nodejs
How to implement g rpc services in nodejsHow to implement g rpc services in nodejs
How to implement g rpc services in nodejs
 
1 plsql introduction1
1 plsql introduction11 plsql introduction1
1 plsql introduction1
 

More from gaurav444u

Health Care Unions Find a Voice as the Pandemic Rages - The New York T.pdf
Health Care Unions Find a Voice as the Pandemic Rages - The New York T.pdfHealth Care Unions Find a Voice as the Pandemic Rages - The New York T.pdf
Health Care Unions Find a Voice as the Pandemic Rages - The New York T.pdf
gaurav444u
 
Health - Related Questions 1- What three pieces of information are gat.pdf
Health - Related Questions 1- What three pieces of information are gat.pdfHealth - Related Questions 1- What three pieces of information are gat.pdf
Health - Related Questions 1- What three pieces of information are gat.pdf
gaurav444u
 
Health Information Technology (HIT) as Electronic Health Record (EHR).pdf
Health Information Technology (HIT) as Electronic Health Record (EHR).pdfHealth Information Technology (HIT) as Electronic Health Record (EHR).pdf
Health Information Technology (HIT) as Electronic Health Record (EHR).pdf
gaurav444u
 
Headlands Limited has the following information available regarding it.pdf
Headlands Limited has the following information available regarding it.pdfHeadlands Limited has the following information available regarding it.pdf
Headlands Limited has the following information available regarding it.pdf
gaurav444u
 
he method by which glucose is transported into a cell depends on the m.pdf
he method by which glucose is transported into a cell depends on the m.pdfhe method by which glucose is transported into a cell depends on the m.pdf
he method by which glucose is transported into a cell depends on the m.pdf
gaurav444u
 
he City Council of Inman Village approved a budget with estimated reve.pdf
he City Council of Inman Village approved a budget with estimated reve.pdfhe City Council of Inman Village approved a budget with estimated reve.pdf
he City Council of Inman Village approved a budget with estimated reve.pdf
gaurav444u
 
he department has expanded telehealth and device-monitoring services-.pdf
he department has expanded telehealth and device-monitoring services-.pdfhe department has expanded telehealth and device-monitoring services-.pdf
he department has expanded telehealth and device-monitoring services-.pdf
gaurav444u
 
he evolution of eukaryotic cells most likely occurred in many steps- O.pdf
he evolution of eukaryotic cells most likely occurred in many steps- O.pdfhe evolution of eukaryotic cells most likely occurred in many steps- O.pdf
he evolution of eukaryotic cells most likely occurred in many steps- O.pdf
gaurav444u
 
Having passed your board exam- you are now qualified to work in the pa.pdf
Having passed your board exam- you are now qualified to work in the pa.pdfHaving passed your board exam- you are now qualified to work in the pa.pdf
Having passed your board exam- you are now qualified to work in the pa.pdf
gaurav444u
 
Having been lost in the desert for 2 days without water- Marion is bad.pdf
Having been lost in the desert for 2 days without water- Marion is bad.pdfHaving been lost in the desert for 2 days without water- Marion is bad.pdf
Having been lost in the desert for 2 days without water- Marion is bad.pdf
gaurav444u
 
Harvard Case Study- Humana's Bold Goal- 20 Percent Healthier by 2020 -.pdf
Harvard Case Study- Humana's Bold Goal- 20 Percent Healthier by 2020 -.pdfHarvard Case Study- Humana's Bold Goal- 20 Percent Healthier by 2020 -.pdf
Harvard Case Study- Humana's Bold Goal- 20 Percent Healthier by 2020 -.pdf
gaurav444u
 
Harry climbed a ladder to trim some trees- While bending too fast- he.pdf
Harry climbed a ladder to trim some trees- While bending too fast- he.pdfHarry climbed a ladder to trim some trees- While bending too fast- he.pdf
Harry climbed a ladder to trim some trees- While bending too fast- he.pdf
gaurav444u
 
HELP- Add button wont work-- i would click on the button and that page.pdf
HELP- Add button wont work-- i would click on the button and that page.pdfHELP- Add button wont work-- i would click on the button and that page.pdf
HELP- Add button wont work-- i would click on the button and that page.pdf
gaurav444u
 
Help with this substitution program- line 3 of the output is different.pdf
Help with this substitution program- line 3 of the output is different.pdfHelp with this substitution program- line 3 of the output is different.pdf
Help with this substitution program- line 3 of the output is different.pdf
gaurav444u
 
help The following information pertains to Ming Corp- at January 1- Ye.pdf
help The following information pertains to Ming Corp- at January 1- Ye.pdfhelp The following information pertains to Ming Corp- at January 1- Ye.pdf
help The following information pertains to Ming Corp- at January 1- Ye.pdf
gaurav444u
 
Help Tina identify her strengths- weaknesses- the opportunities presen.pdf
Help Tina identify her strengths- weaknesses- the opportunities presen.pdfHelp Tina identify her strengths- weaknesses- the opportunities presen.pdf
Help Tina identify her strengths- weaknesses- the opportunities presen.pdf
gaurav444u
 
Harriet Quarterly wants a 14- return on the $15000 of assets she has i.pdf
Harriet Quarterly wants a 14- return on the $15000 of assets she has i.pdfHarriet Quarterly wants a 14- return on the $15000 of assets she has i.pdf
Harriet Quarterly wants a 14- return on the $15000 of assets she has i.pdf
gaurav444u
 
Harriet is described as someone who -was unusual in her ability to coo.pdf
Harriet is described as someone who -was unusual in her ability to coo.pdfHarriet is described as someone who -was unusual in her ability to coo.pdf
Harriet is described as someone who -was unusual in her ability to coo.pdf
gaurav444u
 
help please- thank you! i need to know the Virginia Department of Educ.pdf
help please- thank you! i need to know the Virginia Department of Educ.pdfhelp please- thank you! i need to know the Virginia Department of Educ.pdf
help please- thank you! i need to know the Virginia Department of Educ.pdf
gaurav444u
 
Help please! 1- You are wanting to know how many sloths are in a pop.pdf
Help please!   1- You are wanting to know how many sloths are in a pop.pdfHelp please!   1- You are wanting to know how many sloths are in a pop.pdf
Help please! 1- You are wanting to know how many sloths are in a pop.pdf
gaurav444u
 

More from gaurav444u (20)

Health Care Unions Find a Voice as the Pandemic Rages - The New York T.pdf
Health Care Unions Find a Voice as the Pandemic Rages - The New York T.pdfHealth Care Unions Find a Voice as the Pandemic Rages - The New York T.pdf
Health Care Unions Find a Voice as the Pandemic Rages - The New York T.pdf
 
Health - Related Questions 1- What three pieces of information are gat.pdf
Health - Related Questions 1- What three pieces of information are gat.pdfHealth - Related Questions 1- What three pieces of information are gat.pdf
Health - Related Questions 1- What three pieces of information are gat.pdf
 
Health Information Technology (HIT) as Electronic Health Record (EHR).pdf
Health Information Technology (HIT) as Electronic Health Record (EHR).pdfHealth Information Technology (HIT) as Electronic Health Record (EHR).pdf
Health Information Technology (HIT) as Electronic Health Record (EHR).pdf
 
Headlands Limited has the following information available regarding it.pdf
Headlands Limited has the following information available regarding it.pdfHeadlands Limited has the following information available regarding it.pdf
Headlands Limited has the following information available regarding it.pdf
 
he method by which glucose is transported into a cell depends on the m.pdf
he method by which glucose is transported into a cell depends on the m.pdfhe method by which glucose is transported into a cell depends on the m.pdf
he method by which glucose is transported into a cell depends on the m.pdf
 
he City Council of Inman Village approved a budget with estimated reve.pdf
he City Council of Inman Village approved a budget with estimated reve.pdfhe City Council of Inman Village approved a budget with estimated reve.pdf
he City Council of Inman Village approved a budget with estimated reve.pdf
 
he department has expanded telehealth and device-monitoring services-.pdf
he department has expanded telehealth and device-monitoring services-.pdfhe department has expanded telehealth and device-monitoring services-.pdf
he department has expanded telehealth and device-monitoring services-.pdf
 
he evolution of eukaryotic cells most likely occurred in many steps- O.pdf
he evolution of eukaryotic cells most likely occurred in many steps- O.pdfhe evolution of eukaryotic cells most likely occurred in many steps- O.pdf
he evolution of eukaryotic cells most likely occurred in many steps- O.pdf
 
Having passed your board exam- you are now qualified to work in the pa.pdf
Having passed your board exam- you are now qualified to work in the pa.pdfHaving passed your board exam- you are now qualified to work in the pa.pdf
Having passed your board exam- you are now qualified to work in the pa.pdf
 
Having been lost in the desert for 2 days without water- Marion is bad.pdf
Having been lost in the desert for 2 days without water- Marion is bad.pdfHaving been lost in the desert for 2 days without water- Marion is bad.pdf
Having been lost in the desert for 2 days without water- Marion is bad.pdf
 
Harvard Case Study- Humana's Bold Goal- 20 Percent Healthier by 2020 -.pdf
Harvard Case Study- Humana's Bold Goal- 20 Percent Healthier by 2020 -.pdfHarvard Case Study- Humana's Bold Goal- 20 Percent Healthier by 2020 -.pdf
Harvard Case Study- Humana's Bold Goal- 20 Percent Healthier by 2020 -.pdf
 
Harry climbed a ladder to trim some trees- While bending too fast- he.pdf
Harry climbed a ladder to trim some trees- While bending too fast- he.pdfHarry climbed a ladder to trim some trees- While bending too fast- he.pdf
Harry climbed a ladder to trim some trees- While bending too fast- he.pdf
 
HELP- Add button wont work-- i would click on the button and that page.pdf
HELP- Add button wont work-- i would click on the button and that page.pdfHELP- Add button wont work-- i would click on the button and that page.pdf
HELP- Add button wont work-- i would click on the button and that page.pdf
 
Help with this substitution program- line 3 of the output is different.pdf
Help with this substitution program- line 3 of the output is different.pdfHelp with this substitution program- line 3 of the output is different.pdf
Help with this substitution program- line 3 of the output is different.pdf
 
help The following information pertains to Ming Corp- at January 1- Ye.pdf
help The following information pertains to Ming Corp- at January 1- Ye.pdfhelp The following information pertains to Ming Corp- at January 1- Ye.pdf
help The following information pertains to Ming Corp- at January 1- Ye.pdf
 
Help Tina identify her strengths- weaknesses- the opportunities presen.pdf
Help Tina identify her strengths- weaknesses- the opportunities presen.pdfHelp Tina identify her strengths- weaknesses- the opportunities presen.pdf
Help Tina identify her strengths- weaknesses- the opportunities presen.pdf
 
Harriet Quarterly wants a 14- return on the $15000 of assets she has i.pdf
Harriet Quarterly wants a 14- return on the $15000 of assets she has i.pdfHarriet Quarterly wants a 14- return on the $15000 of assets she has i.pdf
Harriet Quarterly wants a 14- return on the $15000 of assets she has i.pdf
 
Harriet is described as someone who -was unusual in her ability to coo.pdf
Harriet is described as someone who -was unusual in her ability to coo.pdfHarriet is described as someone who -was unusual in her ability to coo.pdf
Harriet is described as someone who -was unusual in her ability to coo.pdf
 
help please- thank you! i need to know the Virginia Department of Educ.pdf
help please- thank you! i need to know the Virginia Department of Educ.pdfhelp please- thank you! i need to know the Virginia Department of Educ.pdf
help please- thank you! i need to know the Virginia Department of Educ.pdf
 
Help please! 1- You are wanting to know how many sloths are in a pop.pdf
Help please!   1- You are wanting to know how many sloths are in a pop.pdfHelp please!   1- You are wanting to know how many sloths are in a pop.pdf
Help please! 1- You are wanting to know how many sloths are in a pop.pdf
 

Recently uploaded

Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
EduSkills OECD
 
Chapter -12, Antibiotics (One Page Notes).pdf
Chapter -12, Antibiotics (One Page Notes).pdfChapter -12, Antibiotics (One Page Notes).pdf
Chapter -12, Antibiotics (One Page Notes).pdf
Kartik Tiwari
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
vaibhavrinwa19
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
Levi Shapiro
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
Scholarhat
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
DhatriParmar
 
Multithreading_in_C++ - std::thread, race condition
Multithreading_in_C++ - std::thread, race conditionMultithreading_in_C++ - std::thread, race condition
Multithreading_in_C++ - std::thread, race condition
Mohammed Sikander
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdfMASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
goswamiyash170123
 
The Diamond Necklace by Guy De Maupassant.pptx
The Diamond Necklace by Guy De Maupassant.pptxThe Diamond Necklace by Guy De Maupassant.pptx
The Diamond Necklace by Guy De Maupassant.pptx
DhatriParmar
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Atul Kumar Singh
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
Jisc
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
Sandy Millin
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
Peter Windle
 
Marketing internship report file for MBA
Marketing internship report file for MBAMarketing internship report file for MBA
Marketing internship report file for MBA
gb193092
 
Digital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion DesignsDigital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion Designs
chanes7
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 

Recently uploaded (20)

Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
 
Chapter -12, Antibiotics (One Page Notes).pdf
Chapter -12, Antibiotics (One Page Notes).pdfChapter -12, Antibiotics (One Page Notes).pdf
Chapter -12, Antibiotics (One Page Notes).pdf
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
 
Multithreading_in_C++ - std::thread, race condition
Multithreading_in_C++ - std::thread, race conditionMultithreading_in_C++ - std::thread, race condition
Multithreading_in_C++ - std::thread, race condition
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdfMASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
 
The Diamond Necklace by Guy De Maupassant.pptx
The Diamond Necklace by Guy De Maupassant.pptxThe Diamond Necklace by Guy De Maupassant.pptx
The Diamond Necklace by Guy De Maupassant.pptx
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
 
Marketing internship report file for MBA
Marketing internship report file for MBAMarketing internship report file for MBA
Marketing internship report file for MBA
 
Digital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion DesignsDigital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion Designs
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 

Header #include -string- #include -vector- #include -iostream- using.pdf

  • 1. Header #include <string> #include <vector> #include <iostream> using namespace std; enum Gender { MALE, FEMALE }; class Student{ private: long id; // Unique ID string name; // Name of student Gender gender; // Gender of student string courseCode; // Course code (CIIC or ICOM) double gpa; // GPA of student public: Student(long id, const string &name, Gender gender, double gpa){ this->id = id; this->name = name; this->gender = gender; this->courseCode = "";
  • 2. this->gpa = gpa; } Student(long id, const string &name, Gender gender, string courseCode, double gpa){ this->id = id; this->name = name; this->gender = gender; this->courseCode = courseCode; this->gpa = gpa; } Student(){} static string toString(Student& s){ string genderLetter = (s.gender == MALE ? "M" : "F"); return string("{" + to_string(s.id) + "," + s.name + "," + genderLetter + "," + to_string(s.gpa) + "}"); } static string toString(vector<Student>& v){ string result = "{"; for (Student s : v) { result += toString(s) + ","; } result += "}"; return result; } static string toString(vector<long>& v){
  • 3. string result = "{"; for (long id : v) { result += to_string(id) + ","; } result += "}"; return result; } // Getters long getID() const {return id;} string getName() const {return name;} Gender getGender() const {return gender;} double getGPA() const {return gpa;} string getCourseCode() const {return courseCode;} //Setters void setName(string name){this->name = name;} void setGender(Gender gender){this->gender = gender;} void setGPA(double gpa){this->gpa = gpa;} void setCourseCode(string code){this->courseCode = code;} // EXERCISES static double maxStudentGPA(vector<Student>& v); static double minStudentGPA(vector<Student>& v); static double averageGPA(vector<Student> &v, int N); static vector<long> countStudents(vector<Student>& v, string code);
  • 4. static void removeByID(vector<Student> &v, long ID); static void updateStudent(vector<Student> &v, const Student &s); static vector<Student> findStudents(vector<Student>& v, float gpa); static vector<Student> repeatedStudentNames(vector<Student>& v); }; Cpp file #include "Student.h" using namespace std; /* * EXERCISE: #1A * * IMPLEMENT USING AN ENHANCED FOR LOOP (ForEach). * * Returns the highest GPA value possessed by any Student in the given list. * */ double Student::maxStudentGPA(vector<Student>& v) { //YOUR CODE HERE return -99.9; //DUMMY RETURN } /* * EXERCISE: #1B
  • 5. * * IMPLEMENT USING A REGULAR FOR LOOP. * * Returns the lowest GPA value possessed by any Student in the given list. * */ double Student::minStudentGPA(vector<Student>& v) { //YOUR CODE HERE return -99.9; //DUMMY RETURN } /* * Exercise #1C * * IMPLEMENT USING A WHILE LOOP * * For the first N students, calculate the average gpa * * Formula: average = sum / N * Assume N is greater than 0 */ double Student::averageGPA(vector<Student> &v, int N){ //YOUR CODE HERE
  • 6. return -99.9; //DUMMY RETURN } /** * * EXERCISE #2 * * IMPLEMENT IT USING AN ENHANCED FOR LOOP (ForEach) * * Given a course code, you must return a vector that contains * only the unique ID of the Students that have that particular course code. */ vector<long> Student::countStudents(vector<Student>& v, string code){ vector<long> result; //YOUR CODE HERE return result; } /* * EXERCISE #3 * * IMPLEMENT USING A DO...WHILE LOOP * * Return a vector that contains all the Students that have a GPA greater * or equal to the GPA passed as the parameter
  • 7. * * Assume the list contains at least one element */ vector<Student> Student::findStudents(vector<Student>& v, float gpa){ //YOU CODE HERE return v; } /* * EXERCISE: #4 * * IMPLEMENT WITH ANY LOOP * * Removes the first occurrence of the specified Student ID, * if it is present. If not present, then list is unchanged. * * HINT: Verify the methods erase() and begin() of the vector */ void Student::removeByID(vector<Student> &v, long ID){ //YOUR CODE HERE } /* * EXERCISE #5 *
  • 8. * DO NOT USE WHILE LOOPS * * Find the Student record that matches the given Student * and update its data. If the Student is not present, add it to the list. * * Remember that each Student has an unique identifier */ void Student::updateStudent(vector<Student> &v, const Student &s){ //YOUR CODE HERE } /* * BONUS * * IMPLEMENT WITH NESTED LOOPS USING ANY LOOP. * * Returns a vector cointaining two Students that has the same name. * If there is no repeated names, the vector stays empty. * * HINT: Use the compare method of the string library */ vector<Student> Student::repeatedStudentNames(vector<Student>& v){ //YOUR CODE HERE return v;
  • 9. }