Question: 5 3 6 8 3 8 . 4 0 5 2 2 5 2 . qx 3 zqy 7 Jump to level 1 The Student

536838.4052252.qx3zqy7
Jump to level 1
The Student class has a default constructor, a constructor with two parameters, and a constructor with three parameters. Declare
the following objects:
student1 with no arguments
1
2
3
student2 with studentName and studentAge as arguments
student3 with studentName, studentAge, and studentHeight as arguments
Ex: If the input is Aya 294.50, then the output is:
Student: None, -1,0.00
Student: Aya, 29,0.00
Student: Aya, 29,4.50
#include
#include
#include
using namespace std;
class Student {
public:
Student();
Student(string studentName, int studentAge);
Student(string studentName, int studentAge, double studentHeight);
void Print();
private:
string name;
int age;
double height;
};
// Default constructor
Student::Student(){
name = "None";
age =-1;
height =0.0;
}
Student::Student(string studentName, int studentAge){
name = studentName;
age = studentAge;
height =0.0;
}
Student::Student(string studentName, int studentAge, double studentHeight){
name = studentName;
age = studentAge;
height = studentHeight;
}
void Student::Print(){
cout fixed setprecision(2) "Student: " name "," age "," height endl;
}
int main(){
string studentName;
int studentAge;
double studentHeight;
cin >> studentName;
cin >> studentAge;
cin >> studentHeight;
/* Your code goes here */
student1.Print();
student2.Print();
student3.Print();
return 0;
}
5 3 6 8 3 8 . 4 0 5 2 2 5 2 . qx 3 zqy 7 Jump to

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!