m> #include #include #include
Addition of Two Numbers
Adding two numbers in programming is essentially the same as adding two numbers in general arithmetic. A significant difference is that in programming, you need to pay attention to the data type of the variable that will hold the sum of two numbers.
C++
C++ is a general-purpose hybrid language, which supports both OOPs and procedural language designed and developed by Bjarne Stroustrup. It began in 1979 as “C with Classes” at Bell Labs and first appeared in the year 1985 as C++. It is the superset of C programming language, because it uses most of the C code syntax. Due to its hybrid functionality, it used to develop embedded systems, operating systems, web browser, GUI and video games.
Write a
- Using the attached code as a "model", write a program where each student record is constructed using the class StudentRec.
- The variables in this case are "private" and the functions are "public."
- Note: only the first_name and last_name variables will require "getter" functions that return the name in all caps:
get_first_name_upper() and get_last_name_upper() functions.
- Your class declaration section should look something like this:
class StudentRec
{
private:
string last_name = ""; // Last name
string first_name = ""; // First name
int year_grad = 0; // Year expected to graduate
float gpa = 0.0; // Current gpa
public:
void set_last_name(string last_name_param);
string get_last_name() const;
string get_last_name_upper() const;
// the rest of the "setter" and "getter" functions for each variable above go here
}; // NOTE: a class declaration ends with a semicolon
- The program should ask for the data to fill a studentRec of class StudentRec and then ask y/n if they want to add another studentRec.
- Each studentRec will go into the vector of type StudentRec called student_list.
- After the student records have been entered into the vector student_list, find the average gpa of all the students in the vector.
- Output all the student records and give the average gpa for the students. Use the iomanip tools to make the data look as nice a possible.
given -
Write a program that inputs, processes, and outputs a set of student records organized as a vector of class StudentRec objects.
- Using the attached code as a "model", write a program where each student record is constructed using the class StudentRec.
- The variables in this case are "private" and the functions are "public."
- Note: only the first_name and last_name variables will require "getter" functions that return the name in all caps:
get_first_name_upper() and get_last_name_upper() functions.
- Your class declaration section should look something like this:
class StudentRec
{
private:
string last_name = ""; // Last name
string first_name = ""; // First name
int year_grad = 0; // Year expected to graduate
float gpa = 0.0; // Current gpa
public:
void set_last_name(string last_name_param);
string get_last_name() const;
string get_last_name_upper() const;
// the rest of the "setter" and "getter" functions for each variable above go here
}; // NOTE: a class declaration ends with a semicolon
- The program should ask for the data to fill a studentRec of class StudentRec and then ask y/n if they want to add another studentRec.
- Each studentRec will go into the vector of type StudentRec called student_list.
- After the student records have been entered into the vector student_list, find the average gpa of all the students in the vector.
- Output all the student records and give the average gpa for the students. Use the iomanip tools to make the data look as nice a possible.
Step by step
Solved in 3 steps with 1 images