import java.util.Scanner;
public class Library {
public static void main(String [] args) {
/*
* Patron class: name + 3 books
* Book class: author + title
*/
Book TwelveYears = new Book ("12 Years a Slave", "Solomon Northup");
Book Diary = new Book ("The Diary of John Smith", "John Smith");
Book Fahrenheit451 = new Book ("Fahrenheit 451", "Ray Bradbury");
Book Gatsby = new Book ("The Great Gatsby", "Fitzgerald");
Book Antigone = new Book ("12 Years a Slave", "Sophocles");
System.out.println("Welcome to library account management! Here is a list of books to check out: " +TwelveYears.getBookTitle()+", "+Diary.getBookTitle()+", "+Fahrenheit451.getBookTitle()+", "+Gatsby.getBookTitle()+", "+Antigone.getBookTitle()+".");
Scanner sc=new Scanner(System.in);
System.out.println("Enter your name!");
String enteredName = sc.nextLine();
System.out.println("Enter your first book! Enter it exactly as seen above.");
String book1 = sc.nextLine();
System.out.println("Enter your second book!");
String book2 = sc.nextLine();
System.out.println("Enter your third book!");
String book3 = sc.nextLine();
Patron patron1 = new Patron(enteredName, book1, book2, book3);
book1 = //line I need help on
System.out.println("Here are the books you are checking out: " +book1+ ", " +book2+ ", " +book3+ ".");
}
}
Here, I'm trying to take the book1 variable, and assosciate it with a member of a class properly. I think the best way to explain what I'm trying to do here is with an example: if book1 entered by the user is "12 Years a Slave" then book1's value would be "TwelveYears", one of the class definitions near the start of the code, so in the future, I could use an accessor/mutator method like book1.getAuthor.
I'm just learning java, so I lack the ways to properly explain this most likely, so I apologize, but any help would be greatly appreciated, and I would be happy to answer any questions if what I'm trying to do here, but I hope I was clear enough.
Thank you!