Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class LabAssign2 {
- public static void main(String[] args){
- String date;
- String month;
- String day;
- String year;
- String address;
- String address2;
- String address3;
- Scanner console = new Scanner(System.in);
- System.out.print("What is the old date? ");
- date = console.nextLine();
- month = date.substring(0,date.indexOf('/'));
- day = date.substring(date.indexOf('/')+1, date.indexOf('/')+3);
- year = date.substring(date.indexOf('/')+6, date.indexOf('/')+8);
- System.out.print("What is the old address? ");
- address = console.nextLine();
- address2 = address.substring (0, address.indexOf(','));
- address3 = address.substring (address.indexOf(',')+2);
- System.out.println(day + "/" + month + "/" + year);
- System.out.println(address2);
- System.out.println(address3);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement