Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

How to modify the code based on the information given: a. Each object of memberT

ID: 3656829 • Letter: H

Question

How to modify the code based on the information given:

a. Each object of memberType can hold the name of a person, member ID, number of books bought, and amount spent.

b. Include the member functions to perform the various operations on the objects of memberType

Explanation / Answer

//I remember this code. I think you got a little confused with the getMembersData //fxn. //If you decided that count was not given in your input file, you would need to //comment out read in count line void getMembersData(memberType m[],int& count) { string ID, fName, lName; int bookCount; double amount; count = 0; ifstream infile; // Declare an input file infile.open("Project9Data.DAT"); //Open the file //infile >> count; //> ID >> fName >> lName >> bookCount >> amount; //ok, but does not check for if infile>> failed /* Use a while statement to : read the input record values for ID, fName, lName, bookCount and amount load the array of object variables invoking the setMemberInfo member */ while( !infile.eof() && count < 500) { m[count].setMemberInfo(ID, fName, lName, bookCount,amount); infile >> ID >> fName >> lName >> bookCount >> amount; count++; } infile.close(); return; } //________________________________________________________ //to access more data directly, guess you can add these functions in header file: string getName()const; string getID()const; //___________________________________________ //and below to implementation file string memberType::getName()const{ return firstName+" "+lastName; } string memberType::getID()const{ return memberID; }
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote