Advertisement
Guest User

Untitled

a guest
Jul 20th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.87 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class LabAssign2 {
  4.   public static void main(String[] args){
  5.     String date;
  6.     String month;
  7.     String day;
  8.     String year;
  9.     String address;
  10.     String address2;
  11.     String address3;
  12.    
  13. Scanner console = new Scanner(System.in);
  14.  
  15. System.out.print("What is the old date? ");
  16. date = console.nextLine();
  17.  
  18. month = date.substring(0,date.indexOf('/'));
  19. day = date.substring(date.indexOf('/')+1, date.indexOf('/')+3);
  20. year = date.substring(date.indexOf('/')+6, date.indexOf('/')+8);
  21.  
  22.                        
  23.  
  24. System.out.print("What is the old address? ");
  25. address = console.nextLine();
  26.  
  27.  
  28. address2 = address.substring (0, address.indexOf(','));
  29. address3 = address.substring (address.indexOf(',')+2);
  30.  
  31. System.out.println(day + "/" + month + "/" + year);
  32. System.out.println(address2);
  33. System.out.println(address3);
  34.  
  35.  
  36.   }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement