#include #include using namespace std; struct Person // c programming { string FirstName = "Unknown"; string LastName = "Unknown"; void setFirstName(string n) { FirstName = n; } string getFirstName() { return FirstName; } }; class Student // C++ programming { private: string FirstName; string LastName; int age; int myWeight() { weight = 30; return weight; } public: int weight; Student() // default constructor { FirstName = "FirstName"; LastName = "LastName"; age = 21; weight = 0; } Student(string f) // another constructor { FirstName = f; LastName = "LastName"; age = 21; weight = 0; } Student (string l, int a) { FirstName = "Unknown"; LastName = l; age = a; weight = 0; } Student (string f, string l) // another constructor { FirstName = f; LastName = l; age = 21; weight = 0; } void setFirstName(string name) { FirstName = name; } string getFirstName() { return FirstName; } string getLastName() { return LastName; } int getAge() { return age; } int getWeight() { return myWeight(); } }; int main() { Person Workers[5]; Workers[2].FirstName = "Bob"; Workers[3].FirstName = "Larry"; // view first name of all Workers for (int i= 0; i<5; i++) { cout << Workers[i].getFirstName() << endl; } Person Peeps[5]; Peeps[0].FirstName = "Barb"; Peeps[0].LastName = "Hecker"; Peeps[1].FirstName = "a"; // cout << "Peeps[0] is " << Peeps[0].FirstName << endl; Student another; // uses default constructor Student Bob1("Bob"); // uses constructor Student Bob("Smith", 34); // also uses a constructor cout << "Another weight is " << another.getWeight() << endl; cout << "Bob is " << Bob.getFirstName() << " " << Bob.getLastName() << " age = " << Bob.getAge() << endl; // another.setFirstName("Another..."); cout << "Another is " << another.getFirstName() << endl; Student myStdPeeps[5]; myStdPeeps[2].setFirstName("Barb"); // cout << "myStdPeeps[2] name is " << myStdPeeps[2].getFirstName() << endl; return 0; }