I am trying to write a program and one of the class requires to have the following attributes. · String name for the bookstore name · A five element String array that will contain the list of books the store has: o War and Peace o Animal Farm o Watership Down o Emma o Introduction to Java · A five element double array that corresponds to the list above and had the price of each book. o $ 7 o $ 8 o $ 9 o $ 10 o $ 20 I am still have trouble understanding arrays. Anybody know i site that could help me with Arrays and possibly constructors.
hey, check out: http://bbs.clutchcity.net/showthread.php?s=&threadid=31915 its a small program that uses arrays in almost the same manner as your program. http://www.calicotech.org/prices/1.html if you didnt use arrays in your program, you would just make variables book1=War and Peace; book2=Animal Farm; etc... And then price1=7; price2=8; However when you show the display there is a lot of unnecessary code you will need to write inorder to show War and Peace = $8. Using arrays, you can display the whole output with a loop. Image, this code is showing the book for all of the store. It would take forever with the 1st method, but with arrays, it will still take you 3 lines to show 5 books or 5000 books. for (j=0; j(less than)nameofarray.length; j++) { document.write ("name of book" +book[j]+ " has a price of: " +price[j]+ "<br>"); }