C++ PLEASE Lab on virtual functions school_virtual.cpp Make a copy of school.cpp and name it school_virtual.cpp Get an i

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

C++ PLEASE Lab on virtual functions school_virtual.cpp Make a copy of school.cpp and name it school_virtual.cpp Get an i

Post by answerhappygod »

C++ PLEASE
Lab on virtual functions school_virtual.cpp Make a copy of
school.cpp and name it school_virtual.cpp Get an input file called
campus.dat from my public directory. 3 Meg Ryan 666-44-5555
[email protected] MATH 3.75 J 2 Sophie Watkins 222-11-4444
[email protected] 110 15 1 Mike Smith 111-22-3333 [email protected] 3
Bob Lopez 333-44-5555 [email protected] CS 3.25 S 2 Kathy Ross
222-33-4444 [email protected] 100 5 1 means Person 2 means Faculty 3
means Student Make a function called readData to make a linked list
of all the people from the input file. See the picture on the
bottom. The element field points to an Person, Faculty or Student
object.
Please read instructions carefully
C Please Lab On Virtual Functions School Virtual Cpp Make A Copy Of School Cpp And Name It School Virtual Cpp Get An I 1
C Please Lab On Virtual Functions School Virtual Cpp Make A Copy Of School Cpp And Name It School Virtual Cpp Get An I 1 (102.19 KiB) Viewed 75 times
C Please Lab On Virtual Functions School Virtual Cpp Make A Copy Of School Cpp And Name It School Virtual Cpp Get An I 2
C Please Lab On Virtual Functions School Virtual Cpp Make A Copy Of School Cpp And Name It School Virtual Cpp Get An I 2 (36.47 KiB) Viewed 75 times
C Please Lab On Virtual Functions School Virtual Cpp Make A Copy Of School Cpp And Name It School Virtual Cpp Get An I 3
C Please Lab On Virtual Functions School Virtual Cpp Make A Copy Of School Cpp And Name It School Virtual Cpp Get An I 3 (21.85 KiB) Viewed 75 times
C Please Lab On Virtual Functions School Virtual Cpp Make A Copy Of School Cpp And Name It School Virtual Cpp Get An I 4
C Please Lab On Virtual Functions School Virtual Cpp Make A Copy Of School Cpp And Name It School Virtual Cpp Get An I 4 (13.55 KiB) Viewed 75 times
C Please Lab On Virtual Functions School Virtual Cpp Make A Copy Of School Cpp And Name It School Virtual Cpp Get An I 5
C Please Lab On Virtual Functions School Virtual Cpp Make A Copy Of School Cpp And Name It School Virtual Cpp Get An I 5 (24.48 KiB) Viewed 75 times
Expected Outputs:
C Please Lab On Virtual Functions School Virtual Cpp Make A Copy Of School Cpp And Name It School Virtual Cpp Get An I 6
C Please Lab On Virtual Functions School Virtual Cpp Make A Copy Of School Cpp And Name It School Virtual Cpp Get An I 6 (77.73 KiB) Viewed 75 times
Lab on virtual functions school_virtual.cpp Make a copy of school.cpp and name it school_virtual.cpp Get an input file called campus.dat from my public directory. 3 Meg Ryan 666-44-5555 [email protected] MATH 3.75 ) 2 Sophie Watkins 222-11-4444 [email protected] 110 15 1 Mike Smith 111-22-3333 [email protected] 3 Bob Lopez 333-44-5555 [email protected] CS 3.25 S 2 Kathy Ross 222-33-4444 [email protected] 100 5 1 means Person 2 means Faculty 3 means Student Make a function called readData to make a linked list of all the people from the input file. See the picture on the bottom. The element field points to an Person, Faculty or Student object. Make a c-stand-alone function called display (created in a client. not a member function of any classses) to show the information about all the people by calling printinfo(). Don't call LL::printAll() since this would display memory addresses (the element of each node is an address). How do we traverse the list in the client? Add ONLY the following member functions and an exception class to LL_T. getFront() getRear() getNext(???){if p is null, throw an OutOfBoundary exception} exception class OutOfBoundary

Make a c-stand-alone function called sort to sort all the people by SSN using the selection sort algorithm. You might want to check your selectionSortAll.cpp. Requirement: Don't overwrite data inside a Person, Faculty or Student object. Instead swap pointers (addresses). Student obj Kathy Faculty obi Faculty obj Sophie Person obi Mike 111 Student obj Bob Meg 666

#include <iostream> using namespace std; #include "LL_1.h" *Person Class class Person { protected: static int num; // total number of people created static int current_id; const int id; string firstname; string lastname; string SSN; string email; public: Person(string f = "unknown", string 1 "unknown", string s = "000-00-0000", string e = void printInfo(); static int getNum(); static int getCurrentID(); }; "unknown"); int Person:: num = B; int Person: :current_id = 1000; Person::Person(string f, string 1, string s, string e): id(current_id) { num++; current_id++; firstname = f;

Person::Person(string f, string 1, string s, string e): id(current_id) { num++; current_id++; firstname f; lastname 1; SSN = 5; email = e; } void Person:: printInfo() { cout << id << " (ID) "<< firstname << } (fn) << lastname << (In) " «< SSN «< " (SSN) " << email « (email) int Person::getNum() { return num; } int Person::getCurrentId() { return current_id; }

= ****** Faculty class* class Faculty : public Person { private: int D_id; int ys; public: Faculty (string f = "unknown", string 1 = "unknown", string s = "000-00-0000", string e = "unknown", int d = -1, int y { D_id = d; ys = y; } void printInfo() { Person::printInfo(); cout << D_id << (department id) << ys << (years at school) << endl; } }; **Student** class Student : public Person { private: string major; double gpa; char grade; public: Student(string f = "unknown", string 1 = "unknown", string s = "000-00-0000", string e = "unknown", string m = "unknown", { major gpa = g grade = gr; = m;

Student(string † = "unknown", string 1 = "unknown", string 5 = "000-00-0000", string e = "unknown", string m = "unknown"; { major = m; gpa = g; grade = gr; } void printInfo() { Person::printInfo(); cout << major << (major) " << gpa «< " (gpa) " «< grade << " (grade) " << endl; } }; int main() { Person p; Faculty f("Kathy", "Ross", "222-33-4444", "[email protected]", 100, 2); Student si"Tom", "Lopez", "333-44-5555", "[email protected]", "CS", 3.33, 'I'); cout << "Person: "; p.printInfo(); cout << endl << "Faculty: "; f.printInfo(); cout << "Student: "; s.printInfo(); cout << "Num = " « p.getNum() << endl; cout << "Current ID << p-getCurrentID() << endl; return; }

Printing everyone in the list Student :: print Info() Person::printInfo() 1800 (ID) Meg(first_nane) Ryan(Last_nane) 666-44-5555(SSN) megecsusm.edu(enail) MATH (major) 3.75 (gpa) (grade level) Faculty::printInfo() Person::printInfo() 1001 (ID) Sophie(first_name) Watkins (last_name) 222-11-4444(SSN) [email protected](email) 110(dep_id) 15 (years) Person::printInfo() 1802(ID) Mike(first_nane) Smith(last_name) 111-22-3333(SSN) mikegcsusm.edu(email) Student :: printInfo() Person::printInfo() 1003 (ID) Bob(first_nane) Lopez (last_name) 333-44-5555(SSN) [email protected](email) CS(major) 3.25 (gpa) S(grade level) Faculty::printInfo) Person::printInfo() 1004 (ID) Kathy(first_name) Ross(last_name) 222-33-4444 (SSN) [email protected](email) 100(dep_id) 5(years) Printing everyone in the list after sort Person::printInfo() 1802(ID) Mike(first_nane) Smith(Last_name) 111-22-3333 (SSN) mikegcsusm.edu(email) Faculty::print Info] Person::printInfo() 1881 (ID) Sophie(first_name) Watkins (last_nane) 222-11-4444(SSN) sophlegcsusn.edu(email) 110(dep_id) 15 (years) Faculty:: printInfo() Person::printInfo() 1004 (ID) Kathy(first_name) Ross(last_name) 222-33-4444 (SSN) [email protected](email) 100(dep_id) 5(years) Student :: printInfo() Person::printInfo() 1003 (ID) Bob(first_name) Lopez( Last_name) 333-44-5555(SSN) [email protected](email) CS(major) 3.25 (gpal S(grade level) Student :: printInfo() Person::printInfo() 1000 (ID) Meg(first_name) Ryan(last_name) 666-44-5555 (SSN) [email protected](email) MATH (major) 3.75(gpa) (grade level)
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply