Advertisement
Guest User

Untitled

a guest
Feb 26th, 2020
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.61 KB | None | 0 0
  1. public class BookTestHelp
  2. {
  3.     public static void main(String args[])
  4.     {
  5.         //declare data array here
  6.         String data[][] = {{"Abraham Lincoln Vampire Hunter", "Grahame-Smith", "Wiley", "978-04465 63079", "13.99"},
  7.         {"Frankenstein", "Shelley", "Prescott", "978-0486282114", "7.99"},
  8.         {"Life of Kennedy", "Jones", "Pearson", "758-29304566", "12.90"},
  9.         {"Dracula", "Stoker", "Addison", "978-0486411095", "5.99"},
  10.         {"Curse of the Wolfman", "Hageman", "Wesley", "B00381AKHG", "10.59"},
  11.         {"How to Pass Java", "Willis", "Wiley", "444-395869790", "1.99"},
  12.         {"The Mummy", "Rice", "Addision", "978-0345369949", "7.99"},
  13.         {"History of Texas", "Smith", "Prescott", "123-683947687", "9.75"}};
  14.  
  15.         //bArray declare here
  16.         double quantity[] = {12, 8, 3, 53, 7, 23, 14, 5};
  17.         //declare all the data
  18.        
  19.         //call buildinstances recieves bookarray
  20.         bArray = buildInstances(dataarray);
  21.        
  22.         //call createcharge
  23.         message = createCharge(dataArray, quatityarray);
  24.        
  25.         //print dialog box
  26.        
  27.     }
  28.    
  29.     public static Book[] buildinstance(String dataarray[][])
  30.     {
  31.         //declare bookarray
  32.     book bookarray[] = new book [dataarray.length];
  33.        
  34.         for index in dataarray
  35.             bookarray[index] = dataarray[i][0], dataarray[i][1], etc to get all the data
  36.        
  37.         //the return the book array
  38.         return array of book
  39.     }
  40.    
  41.     public static String createcharge(Stringpass bookarray, quantityarray)
  42.     {
  43.         //do stuff
  44.         for index in bookarray
  45.             charge = bookarray[index].calculateCharge(quantityarray[index]);
  46.             total += bookarray[index].calculateCharge(quantityarray[index]);
  47.            
  48.             message +=
  49.             //build string
  50.        
  51.         return mystring
  52.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement