Answered step by step
Verified Expert Solution
Question
1 Approved Answer
For this assignment you will write a simple class hierarchy and use functions to carry out common tasks across all child classes. The assignment problem:
For this assignment you will write a simple class hierarchy and use functions to carry out common tasks across all child classes. The assignment problem: , a file called "input.txt" contains all the faculty and students' data. Each line in this file starts with At one of the following letters ('s', 'f). If the line starts with 's', that means this line represents a student (first name, last name, id, major). Otherwise, a faculty member (first name, last name, id, salary). f Toni Alberto 103 95000.3 s Sa. Wael 104 History Nancy Thoeson s06 Geagraphy s Tin Jefferson 107 Art f Andrew azz 108 94900.55 Kyle Zipp 189 68344.99 s Se Anthony 118 EngineeringB You are asked to write a program that reads this input file and separate faculty from students then prints the output of each category to a separate output file. To keep track with each faculty member and each student we need to create an object for each one. To avoid repeating variables and functions, we will create a general class and ca t "Members". This class contains the shared data that each student and faculty member should have (first name, last name, id). Our class should also have the following A constructor that takes no arguments. Members(const string& firstName, const string & lastName, int idNum void printMember() const; . .A constructor that takes three arguments to set the member variable: first name, last name, and id. .A print function "printMember" that prints first name, last name, and the id for the calling object .A function "readWriteMembers that accepts an input file object and output file object to read and write members to files. (The definition in the Base class is not that important since we will use it to read student members or faculty members only). void readWriteMembers ifstream& instream, ofstreamk outstream Getters and setters for the first name, last name, and id
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started