Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions src/Author.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@
import java.util.ArrayList;
import java.util.List;

//@SuppressWarnings({"unchecked", "deprecation"})
public class Author extends Person {
private List books;
private final List<String> books;

public Author(String firstName, String lastName) {
public Author(String firstName, String lastName){
super(firstName, lastName);
books = new ArrayList();
books = new ArrayList<>();

}


/**
* @deprecated Use publishedBooks instead
*/
Expand All @@ -25,10 +28,10 @@ public List<String> publishedBooks() {
}

public void addBook(String book) {
books.add(book);
books.add(book);
}
//I had to fix this in easy_fix??

@Override
public String sortName() {
return String.format("%s, %s", lastName, firstName);
}
Expand Down
3 changes: 2 additions & 1 deletion src/Main.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
//@SuppressWarnings("unchecked")
public class Main {
public static void main(String[] args) {
Author author = new Author("Sandi", "Metz");

author.addBook("Practical Object-Oriented Design in Ruby");
author.addBook("99 Bottles of OOP");

for (String book: author.getBooks()) {
for (String book: author.publishedBooks()) {
System.out.println(book);
}
}
Expand Down
1 change: 1 addition & 0 deletions src/Person.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/**
* This source file is subject to the license that is bundled with this package in the file LICENSE.
*/
//@SuppressWarnings("unchecked")
public class Person {
protected String firstName;
protected String lastName;
Expand Down