add setters and protected no-arg constructor

This commit is contained in:
Sabiq Ihab 2017-06-21 00:52:38 +00:00
parent 8208f6252b
commit f3902ffc16
2 changed files with 34 additions and 2 deletions

View File

@ -32,7 +32,7 @@ public class Author {
this.email = email; this.email = email;
} }
public Author() { protected Author() {
super(); super();
} }
@ -40,18 +40,34 @@ public class Author {
return id; return id;
} }
public void setId(long id) {
this.id = id;
}
public String getUsername() { public String getUsername() {
return username; return username;
} }
public void setUsername(String username) {
this.username = username;
}
public String getName() { public String getName() {
return name; return name;
} }
public void setName(String name) {
this.name = name;
}
public String getEmail() { public String getEmail() {
return email; return email;
} }
public void setEmail(String email) {
this.email = email;
}
@Override @Override
public String toString() { public String toString() {
return "Author [name=" + name + ", email=" + email + "]"; return "Author [name=" + name + ", email=" + email + "]";

View File

@ -34,7 +34,7 @@ public class Book {
this.author = author; this.author = author;
} }
public Book() { protected Book() {
super(); super();
} }
@ -42,18 +42,34 @@ public class Book {
return id; return id;
} }
public void setId(long id) {
this.id = id;
}
public String getTitle() { public String getTitle() {
return title; return title;
} }
public void setTitle(String title) {
this.title = title;
}
public double getPrice() { public double getPrice() {
return price; return price;
} }
public void setPrice(double price) {
this.price = price;
}
public Author getAuthor() { public Author getAuthor() {
return author; return author;
} }
public void setAuthor(Author author) {
this.author = author;
}
@Override @Override
public String toString() { public String toString() {
return "Book [title=" + title + ", price=" + price + ", author=" + author + "]"; return "Book [title=" + title + ", price=" + price + ", author=" + author + "]";