Create a base class named Book. Data fields include title and author; functions
ID: 3636719 • Letter: C
Question
Create a base class named Book. Data fields include title and author; functions include those that can set and display the fields. Derive two classes from the Book class: Fiction, which also contains a numeric grade level, and NonFiction, which contains a variable to hold the number of pages. The functions that set and display the data field values for the subclasses should call the appropriate parent class functionsto set and display the common fields, and include specific code pertaining to the new subclass fields. Write a main() funtion that demonstrates the use of the classes and their functions. Save the file as Book.cpp.The code i have now is broken, and my tutor says that what i was doing was illegal. but that is all the help i got from him, nothing on how to go about fixing it or anything. So any help at at would be greatly appriciated. Thank you
Explanation / Answer
#include #include #include using namespace std; void showall(int f, ofstream& out, string fbook[], int fisbn[], string ffname[], string flname[], double fprice[]); void higher(int b, double yprice[]); void main() { string book[600], fname[600], lname[600]; // up to 600 names int isbn[600]; double price[600]; ofstream outp, outp2; ifstream inp; int i=0, choice, choice2, choice3, choice4; char c; inp.open("proj05.txt"); // Files open outp.open("proj05_output.txt"); if (inp.fail()) { cout > book[i] >> isbn[i] >> fname[i] >> lname[i] >> price[i]; i++; } coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.