Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package finalprogrambook;
- import java.util.Scanner;
- /**
- *
- * @author
- */
- public class FinalProgramBook
- {
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args)
- {
- //These are the variables for this part of the program
- //Parts of the book
- String inputTitle = "";
- String inputAuthor = "";
- int inputPages = 0;
- String inputPubName = "";
- int inputBookYear = 0;
- //These are the objects for the Book class
- Book bookObject = new Book(inputTitle, inputAuthor, inputPages,
- inputPubName,inputBookYear);
- Book copiedBookObject = new Book(bookObject);
- //This scanner takes user input
- Scanner input = new Scanner(System.in);
- //Ask the user for all information on the book
- System.out.println(" Please enter in the following information. ");
- System.out.println(" \nEnter in the book's title: ");
- inputTitle = input.nextLine();
- System.out.println(" \nEnter in the author's name: ");
- inputAuthor = input.nextLine();
- bookObject.setAuthor(inputAuthor);
- System.out.println(" \nEnter in the number of pages in the book: " );
- inputPages = input.nextInt();
- System.out.println(" \nEnter in the publisher's name: ");
- inputPubName = input.nextLine();
- System.out.println(" \nEnter in the year the book was published: ");
- inputBookYear = input.nextInt();
- //See if the book has the same number of pages as the asker book
- System.out.println(" \nWe'll test to see if this book "
- + "has the same number of pages as ours.");
- //both need to have values for pages be more than 0 !!!!!!!!!!!!!!!!!!!!
- if (copiedBookObject.hasSameNumPages(bookObject))
- System.out.println("\nThey do share the same number of pages!");
- else
- System.out.println("\nSorry, they have different amounts of pages.");
- //NEED!!!????????
- ////Display the copy constructor //May not need
- // System.out.println(" \nWe will now display the copy constructor. "
- // + "\n" + copiedBookObject);
- //Display the information the user typed in
- System.out.println(" \nNow we will display what you typed in. ");
- System.out.println(" \nThe title of the book is " + bookObject.getTitle()
- + "\n" + bookObject.toString()); //toString NEEDS CORRECTING ON CLASS FILE
- //NEED SOME SORT OF RETURN VALUES IN FILE
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement