Why it gave me this error "[Error] invalid conversion from 'int' to 'const char*' [-fpermissive]  Can someone help  include #include using namespace std; class Book { private: public: string author; string title; int year; Book(string author, string title, int year) { this->author = author; this->title = title; this->year = year; } string getAuthor() { return author; } void setAuthor(string author) { this-> author = author; } bool publishedBefore(int y) { if(yearattendanceYear = attendanceYear; this->awardName = awardName; } string getAwardName() { return awardName; } int getAttendanceYear() { return attendanceYear; } void setAwardName(string awardName) { this->awardName = awardName; } void setAttendanceYear(int attendanceYear) { this->attendanceYear = attendanceYear; } string toString() { return "Given Award" + awardName + "\n" + "Written in year" + to_string(year); } }; int main () { // book1 1 Book book ("J.K.Rowing", "Fantastic Beats and where to find them- the Crimes of Grindelwald ", 2018); cout<

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Why it gave me this error "[Error] invalid conversion from 'int' to 'const char*' [-fpermissive]
 Can someone help 

include <iostream>
#include <string>

using namespace std;

class Book {
private:

public:
string author;
string title;
int year;

Book(string author, string title, int year) {
this->author = author;
this->title = title;
this->year = year;
}

string getAuthor() {
return author;
}

void setAuthor(string author) {
this-> author = author;
}

bool publishedBefore(int y) {
if(year<y){
return true;
}
else {
return false;
}
}


string toString() {
cout<<endl;
return "Author: " + author + "\n" + "Book name: " + title + "\n" + "Written in year: " + to_string(year);

}
};

class AwardedBook : Book {
private:
int attendanceYear;
string awardName;
public:
AwardedBook(string author, string title, int year, int attendanceYear, string awardName) : Book(author, title, year) {
this->attendanceYear = attendanceYear;
this->awardName = awardName;
}
string getAwardName() {
return awardName;
}
int getAttendanceYear() {
return attendanceYear;
}
void setAwardName(string awardName) {
this->awardName = awardName;
}
void setAttendanceYear(int attendanceYear) {
this->attendanceYear = attendanceYear;
}
string toString() {
return "Given Award" + awardName + "\n" + "Written in year" + to_string(year);

}
};


int main () {

// book1 1

Book book ("J.K.Rowing", "Fantastic Beats and where to find them- the Crimes of Grindelwald ", 2018);
cout<<book.getAuthor()<<endl;
book.setAuthor("Robert Galbraith");
cout << book.getAuthor() << endl;

// book 2

Book book1 ("J.K. Rowing", "Harry Potter and The Chamber of seacret", 1998);
cout<<book1.getAuthor()<<endl;
book1.setAuthor("B.Rusev");
cout<<book1.getAuthor()<<endl;

// book 3

Book book2 ("George R. R. Martin","Games of thrones", 1996);
cout<<book2.getAuthor()<<endl;

book2.setAuthor("M.G.K");
cout<<book2.getAuthor()<<endl;

cout << book.toString() << endl;
int year = 2015;

cout<<endl;

// za book
if(book.publishedBefore(year) == true )
{
cout << "Knigata e pyblikyvana predi" <<" "<<year << endl;
}else
{
cout << "Knigata ne e pyblikyvana predi "<<" "<<year << endl;
}


// za book 1

if(book1.publishedBefore(year) == true )
{
cout << "Knigata e pyblikyvana predi" <<" "<< year << endl;
}
else{
cout << "Knigata ne e pyblikyvana predi"<< " "<< year << endl;
}

//za book 2

if(book2.publishedBefore(year) == true )
{
cout << "Knigata e pyblikyvana predi" <<" "<< year << endl;
}
else{
cout <<"Knigata ne e pyblikyvana predi"<<" "<< year << endl;
}


// Award for book

AwardedBook awb (2019,"Galaxy British Book Awards","J.K.Rowling", "The Crimes of Grindelwald",2018);
cout <<awb.getAwardName() << " " << awb.getAttendanceYear() << endl;


// Award for book 2
AwardedBook awb1(2001,"Whitaker’s Platinum Book Award", "J.K.Rowling","Harry Potter and the Chamber of Seacrets", 2002);
cout << awb1.getAwardName() << " " << awb1.getAttendanceYear() << endl;

// Award for book 3




}

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Declaring and Defining the Function
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education