Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

that is a project for C++ For this assignment you will write a simple class hierarchy and use functions to carry out common tasks across

that is a project for C++

image text in transcribedimage text in transcribedimage text in transcribed

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: At UMKC, a file called "input.txt" contains all the faculty and students' data. Each line in this file starts with 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) Sourc f Zach Shiffer 100 100e0.29 2s Jack Saith 102 Art f Toni Alberto 103 98800.39 s Sam Wael 104 History s Kin Watson 185 Math 6S Nancy Thomson 186 Geography 8f Andrew 3azz 108 94000.55 9f Kyle Zipp 109 68344.09 s Tin Jefferson 107 Art 1s Sam Anthony 110 Engineering 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 call it "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. A constructor that takes three arguments to set the member variable: first name, last name, and id. Members(const string& firstName, const string& lastName, int idNum) A print function "printMember" that prints first name, last name, and the id for the calling object. void printMember0 const 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(ifstreamk instream, ofstream& outstream) Getters and setters for the first name, last name, and id. 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: At UMKC, a file called "input.txt" contains all the faculty and students' data. Each line in this file starts with 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) Sourc f Zach Shiffer 100 100e0.29 2s Jack Saith 102 Art f Toni Alberto 103 98800.39 s Sam Wael 104 History s Kin Watson 185 Math 6S Nancy Thomson 186 Geography 8f Andrew 3azz 108 94000.55 9f Kyle Zipp 109 68344.09 s Tin Jefferson 107 Art 1s Sam Anthony 110 Engineering 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 call it "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. A constructor that takes three arguments to set the member variable: first name, last name, and id. Members(const string& firstName, const string& lastName, int idNum) A print function "printMember" that prints first name, last name, and the id for the calling object. void printMember0 const 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(ifstreamk instream, ofstream& 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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Develop successful mentoring programs. page 400

Answered: 1 week ago