Advertisement
Guest User

Untitled

a guest
Apr 19th, 2018
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class TestPerson
  4. {
  5. public static void main(String[] args)
  6. {
  7. Scanner sc = new Scanner(System.in);
  8. Person[] ar = new Person[3];
  9. String personName;
  10. String personAddress;
  11. int ppsNo;
  12.  
  13. for(int i = 0; i < 3;i++)
  14. {
  15. ar[i] = new Person(sc.nextLine(),sc.nextLine());
  16. }
  17.  
  18. System.out.println("Person 1 is called " + ar[0].getName());
  19. System.out.println("They live in " + ar[0].getAddress());
  20. System.out.println("Their PPS Number is " + ar[0].getPPSNo());
  21.  
  22. ar[1].setName(sc.nextLine());
  23. ar[1].setAddress(sc.nextLine());
  24.  
  25. for(int i = 0;i < 3;i++)
  26. {
  27. ar[i].showPerson();
  28. }
  29.  
  30. System.out.println(ar[2].toString());
  31.  
  32. }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement