Question: Please only post solution code asap. no explanation needed thank u Define the Student class's SetName() mutator that sets data member name to studentName and
Please only post solution code asap. no explanation needed thank u
Define the Student class's SetName() mutator that sets data member name to studentName and the SetHeight() mutator that sets data member height to studentHeight.
Ex: If the input is Ina 5.0, then the output is:
Student: Ina Height: 5.0 feet #include #include #include using namespace std; class Student { public: void SetName(string studentName); void SetHeight(double studentHeight); void Print() const; private: string name; double height; }; /* Your code goes here */ void Student::Print() const { cout << "Student: " << name << endl; cout << "Height: " << fixed << setprecision(1) << height << " feet" << endl; } int main() { Student person; string inputName; double inputHeight; cin >> inputName; cin >> inputHeight; person.SetName(inputName); person.SetHeight(inputHeight); person.Print(); return 0; } Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
