-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBook.cpp
More file actions
31 lines (27 loc) · 1.09 KB
/
Book.cpp
File metadata and controls
31 lines (27 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include "Book.h"
//CONSTRUCTOR
//Default
Book::Book(){}
//Overloaded
Book::Book(int year, string title, string author, double score){
m_year = year;
m_title = title;
m_author = author;
m_score = score;
}
//GETTERS AND SETTERS
int Book::GetYear() {return m_year;} //return year
string Book::GetTitle() {return m_title;} // return title
string Book::GetAuthor() {return m_author;} // return author(s)
double Book::GetScore() {return m_score;} // return rating score
void Book::SetYear(int year) {m_year = year;} //sets year
void Book::SetTitle(string title) {m_title = title;} //sets title
void Book::SetAuthor(string author) {m_author = author;} //sets author(s)
void Book::SetScore(double score) {m_score = score;} //sets score
//Name: DisplayBook
//Precondition: Requires book variables to be populated
//Postcondition: None
//Desc: Displays the information about the book
void Book::DisplayBook(){ // uses the getters to print the statement
cout << GetTitle() << " (" << GetYear() << ") by " << GetAuthor() << " with a score of " << GetScore() << endl;
}