Advertisement
Guest User

Untitled

a guest
Jan 16th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. public classA {
  2. int[] idades;
  3. public int someTudo(String nome) {
  4. int soma = 0;
  5. for(int i = 0; i < 10; i ++) {
  6. if ( verificaIdade(i) ) {
  7. soma += idades[i];
  8. }
  9. }
  10. return soma;
  11. }
  12. private boolean verificaIdade(int id) {
  13. if (idades[id] > 18) {
  14. return true;
  15. } else {
  16. return false;
  17. }
  18. }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement