I need to create a printing method. Once I call the method it will print the following code.

static Book1 a = new Book1("Miasha", "Secret Society", "Borrowed", 743281586);
    static Book1 b = new Book1("Omar Tyree", "What They Want", "On Shelf", 743228695);
    static Book1 c = new Book1("Eric Jerome Dickey", "The Other Women","On Shelf", 525947248)

Any help is needed. I just need to know where to start.

Thanks,

Recommended Answers

All 3 Replies

I expect you have constractor for your book class something like this

public void Book1(String str1, String str2, String str3, int num)
{
   author = srt1;
   title = str2;
   status = str3;
   isbn = num;
}

some get methods

public String getAuthor() { return author;}
public String getTitle() { return title;}
public String getStatus() { return status;}
public int getIsbn() { return isbn;}

so you create method printMe for example

public void printMe( Book1 toPrint)
{
   System.out.println( toPrint.getAuthor() + " - " + toPrint.getTitle()
   + " - " + toPrint.getStatus() + " - " + toPrint.getIsbn() );
}

to call this method you just do this

toPrint(a);
   toPrint(b);
   toPrint(c);

Hope that is any help to you

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.