TestClass
TestClass
Size 1.2 kB - File type text/plainFile contents
/**
* Write a description of class BookTest here.
*
* @author (your name)
* @version (a version number or a date)
*/
import java.util.Scanner;
public class BookTest
{
public static void main(String[] args)
{
Scanner input = new Scanner(System.in);
int counter = 1;
int totalBook=3;
while (counter <= totalBook){
Book b1 = new Book();
b1.setAuthor(new BookAuthor());
System.out.println("-----Book" +counter+"-----");
System.out.print("Enter Name of book: ");
String bookName = input.nextLine();
b1.setTitle(bookName);
System.out.print("Enter first name of author: ");
String firstName = input.nextLine();
b1.getAuthor().setFirst(firstName);
System.out.print("Enter last name of author: ");
String lastName = input.nextLine();
b1.getAuthor().setLast(lastName);
System.out.println(b1.print());
counter++;
}
}
}
Click here to get the file