Personal tools
You are here: Home Comp 170 Introduction to OOP Lab Materials Lab7 TestClass
Document Actions

TestClass

by Mit Patel last modified 2006-03-02 02:55 PM

TestClass

Click here to get the file

Size 1.2 kB - File type text/plain

File 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++;
        }

    }
}


« December 2022 »
Su Mo Tu We Th Fr Sa
123
45678910
11121314151617
18192021222324
25262728293031
 

Powered by Plone CMS, the Open Source Content Management System

This site conforms to the following standards: