Advertisement
Guest User

Untitled

a guest
Feb 21st, 2018
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. package com.mycompany.pl1;
  2. /**
  3. *
  4. * @author Catarina
  5. */
  6. public class Main {
  7.  
  8. public static void main(String[]args){
  9. Pessoa p1=new Pessoa("Catarina",18);
  10. Pessoa p2=new Pessoa("Beatriz",19);
  11. String nome1=p1.getNome();
  12. int idade1=p1.getIdade();
  13. String nome2=p2.getNome();
  14. int idade2=p2.getIdade();
  15. p1.setIdade(18);
  16. p1.setNome("Catarina");
  17. p2.setNome("Beatriz");
  18. p2.setIdade(19);
  19. p1.toString();
  20. p2.toString();
  21. boolean maisVelho=p1.isIdadeMaior(p2);
  22. int diferenca=p1.calcularDiferencaIdade(p2);
  23. int total=p1.getTotalPessoa();
  24. System.out.println("Foram inseridos um total de "+total+" pessoas.A diferença de idades entre a "+ nome1+ " e a "
  25. +nome2+ " é de " +diferenca+ " anos.");
  26.  
  27.  
  28. }
  29.  
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement