Write a program MyLibrary that contains three methods as described below

a. An array String method bookDatabase that contains a list of 20 book names. You are
free to assign any 20 names of your favourite books.
b. An array integer method myBooks that allows you to enter how many books you have
in your library. The number entered must be less than 20. Once this number is entered,
say x, there is a random selection of only x book names from the book database in a).
These book names are stored in an array mybooks[].
Hint: The line below randomly selects the names from an array using Math.random.
String randomS =
names[(int)(Math.random()*names.length)];
c. A void array printbooks() that displays the books in your library from b).
d. Write a program MyLibraryDemo that executes all the methods.

Comments

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories