Advertisement
oona

FedEx (a better success)

Jan 24th, 2014
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.05 KB | None | 0 0
  1. public class fedEx {
  2. public static void main(String[] args) {
  3. // TODO Auto­generated method stub
  4.  
  5. String address[] = {"Norre Sogade, 7 1TV""Gyldenlovesgade, 3 3TV""Schacksgade, 20 2TV",
  6.     "Vesterbrogade, 10 5TV""Borgsgade, 6 4TV""Fredericiagade, 12 3TV""Rigensgade, 40 1TV",
  7.     "Oster Voldgade, 15 2TV""Stockholmsgade, 57 3TV""Adelgade, 35 3TV"};
  8. int zipCode[] = {1370210019511881360020011756200520061420};
  9. String temp1;
  10. int temp2;
  11.  
  12. for(int i=0; i<address.length; i++)
  13.     {
  14.     for(int j=1; j<(address.length­1); j++)
  15.         {
  16.         if(address[1].compareTo(address[j])<0)
  17.             {
  18.             temp1 = address[1];
  19.             address[1] = address[j];
  20.             address[j] = temp1;
  21.  
  22.             temp2 = zipCode[1];
  23.             zipCode[1] = zipCode[j];
  24.             zipCode[j] = temp2;
  25.             }
  26.         }
  27.     }
  28.  
  29. for(int i=0; i<address.length; i++)
  30. System.out.println("Send this letter/packet to this address: " + address[i] + ", " + zipCode[i]);
  31.  
  32. }//class ends
  33. }//program ends
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement