Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class BookTestHelp
- {
- public static void main(String args[])
- {
- //declare data array here
- String data[][] = {{"Abraham Lincoln Vampire Hunter", "Grahame-Smith", "Wiley", "978-04465 63079", "13.99"},
- {"Frankenstein", "Shelley", "Prescott", "978-0486282114", "7.99"},
- {"Life of Kennedy", "Jones", "Pearson", "758-29304566", "12.90"},
- {"Dracula", "Stoker", "Addison", "978-0486411095", "5.99"},
- {"Curse of the Wolfman", "Hageman", "Wesley", "B00381AKHG", "10.59"},
- {"How to Pass Java", "Willis", "Wiley", "444-395869790", "1.99"},
- {"The Mummy", "Rice", "Addision", "978-0345369949", "7.99"},
- {"History of Texas", "Smith", "Prescott", "123-683947687", "9.75"}};
- //bArray declare here
- double quantity[] = {12, 8, 3, 53, 7, 23, 14, 5};
- //declare all the data
- //call buildinstances recieves bookarray
- bArray = buildInstances(dataarray);
- //call createcharge
- message = createCharge(dataArray, quatityarray);
- //print dialog box
- }
- public static Book[] buildinstance(String dataarray[][])
- {
- //declare bookarray
- book bookarray[] = new book [dataarray.length];
- for index in dataarray
- bookarray[index] = dataarray[i][0], dataarray[i][1], etc to get all the data
- //the return the book array
- return array of book
- }
- public static String createcharge(Stringpass bookarray, quantityarray)
- {
- //do stuff
- for index in bookarray
- charge = bookarray[index].calculateCharge(quantityarray[index]);
- total += bookarray[index].calculateCharge(quantityarray[index]);
- message +=
- //build string
- return mystring
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement