Question: I wrote this code and it shows so many errors can someone please help me with the code and explain the errors. Its a C++
I wrote this code and it shows so many errors can someone please help me with the code and explain the errors. Its a C++ code. Thank you in advance for the great help
/* 8. Create a Patron class for the library. The class will have a users name, library card number,
and library fees (if owed). Have functions that access this data, as well as a function to set the fee of the user.
Have a helper function that returns a Boolean (bool) depending on whether or not the user owes a fee.*/
#include "std_lib_facilities_4.h"
#include
class Patron {
private:
string name1;
double card;
double fees;
public:
string getname();
double getcard();
double getfees();
bool isfee();
void set_name(string n);
void set_card(double m);
void set_fees(double f);
Patron(){
name1 = "H" ; card = 0; fees=0;
}
Patron(string n, double c,double f){
name1 = n ; card = c; fees=f;
}
};
string Patron::getname(){
return name1;
}
void Patron :: set_name(string n) {
name1=n;
}
void Patron :: set_card(double m){
card=m;
}
void Patron :: set_fees(double f){
fees=f;
}
double Patron::getcard(){
return card;
}
double Patron :: getfees() {
return fees;
}
bool Patron:: isfee(){
if (fees > '0'){
return true;}
return false;
}
bool operator==(const Patron& a1, const Patron& b1 ) {
return (a1.getfees()==b1.getfees());
}
ostream& operate << (ostream& os , const Patron& d ){
return os << "User Name "<< d.get_username()< } int main(){ Patron a1{"H1",5,1}; Patron b1{"YYYY ",7,10}; a1.Patron::set_fees(10); cout<<"Is there a fee :" << a1.Patron::isfee()< cout<<"Fee is : "< cout<<"Is there a fee :" << a1.Patron::isfee()< cout<<"Fee is : "< bool mmm=a1==b1; cout< cout< return 0; }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
