Answer this in C++: In the Student.cpp file and Student.h file, build the Student class with the following specifications: Private data members string name - Initialized in default constructor to "Louie" double gpa - Initialized in default constructor to 1.0 Default constructor Public member functions SetName() - sets the student's name GetName() - returns the student's name SetGPA() - sets the student's GPA GetGPA() - returns the student's GPA Ex. If a new Student object is created, the default constructor sets name to "Louie" and gpa to 1. The output of GetName() and GetGPA() before and after calling SetName("Felix") and SetGPA(3.7) is: Louie/1 Felix/3.7 main.cpp #include #include #include "Student.h" using namespace std; int main() { Student student = Student(); cout << student.GetName() << "/" << student.GetGPA() << endl; student.SetName("Felix"); student.SetGPA(3.7); cout << student.GetName() << "/" << student.GetGPA() << endl; return 0; } Student.h #ifndef STUDENT_H_ #define STUDENT_H_ #include using namespace std; class Student { public: Student(); void SetName(string n); // FIXME: Declare 3 more functions private: // FIXME: Add 2 private data members }; #endif /* STUDENT_H_ */ Student.cpp // Simple class to hold student information #include "Student.h" #include #include using namespace std; Student::Student() { //FIXME: complete the constructor } void Student::SetName(string n) { //FIXME: complete SetName function } // FIXME: Add 3 more functions
Answer this in C++: In the Student.cpp file and Student.h file, build the Student class with the following specifications: Private data members string name - Initialized in default constructor to "Louie" double gpa - Initialized in default constructor to 1.0 Default constructor Public member functions SetName() - sets the student's name GetName() - returns the student's name SetGPA() - sets the student's GPA GetGPA() - returns the student's GPA Ex. If a new Student object is created, the default constructor sets name to "Louie" and gpa to 1. The output of GetName() and GetGPA() before and after calling SetName("Felix") and SetGPA(3.7) is: Louie/1 Felix/3.7 main.cpp #include #include #include "Student.h" using namespace std; int main() { Student student = Student(); cout << student.GetName() << "/" << student.GetGPA() << endl; student.SetName("Felix"); student.SetGPA(3.7); cout << student.GetName() << "/" << student.GetGPA() << endl; return 0; } Student.h #ifndef STUDENT_H_ #define STUDENT_H_ #include using namespace std; class Student { public: Student(); void SetName(string n); // FIXME: Declare 3 more functions private: // FIXME: Add 2 private data members }; #endif /* STUDENT_H_ */ Student.cpp // Simple class to hold student information #include "Student.h" #include #include using namespace std; Student::Student() { //FIXME: complete the constructor } void Student::SetName(string n) { //FIXME: complete SetName function } // FIXME: Add 3 more functions
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
100%
Answer this in C++:
In the Student.cpp file and Student.h file, build the Student class with the following specifications:
- Private data members
- string name - Initialized in default constructor to "Louie"
- double gpa - Initialized in default constructor to 1.0
- Default constructor
- Public member functions
- SetName() - sets the student's name
- GetName() - returns the student's name
- SetGPA() - sets the student's GPA
- GetGPA() - returns the student's GPA
Ex. If a new Student object is created, the default constructor sets name to "Louie" and gpa to 1. The output of GetName() and GetGPA() before and after calling SetName("Felix") and SetGPA(3.7) is:
Louie/1
Felix/3.7
main.cpp
#include <iostream>
#include <vector>
#include "Student.h"
using namespace std;
int main() {
Student student = Student();
cout << student.GetName() << "/" << student.GetGPA() << endl;
student.SetName("Felix");
student.SetGPA(3.7);
cout << student.GetName() << "/" << student.GetGPA() << endl;
return 0;
}
Student.h
#ifndef STUDENT_H_
#define STUDENT_H_
#include <iostream>
using namespace std;
class Student {
public:
Student();
void SetName(string n);
// FIXME: Declare 3 more functions
private:
// FIXME: Add 2 private data members
};
#endif /* STUDENT_H_ */
Student.cpp
// Simple class to hold student information
#include "Student.h"
#include <iostream>
#include <string>
using namespace std;
Student::Student() {
//FIXME: complete the constructor
}
void Student::SetName(string n) {
//FIXME: complete SetName function
}
// FIXME: Add 3 more functions
Expert Solution
Step 1
The answer is given below:-
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 4 images
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY