Advertisement
Guest User

Untitled

a guest
Dec 16th, 2018
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. package elevador;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Elevador {
  6.  
  7. public static void main(String[] args) {
  8.  
  9. Scanner sc = new Scanner(System.in);
  10.  
  11. System.out.print("INFORME A QUANITDADE DE ANDARES DO PRÉDIO: ");
  12. int qntAndares = sc.nextInt();
  13.  
  14. int qntPessoas = 0;
  15.  
  16. for(int i = 1; i <= qntAndares; i++){
  17. System.out.println("----SIMULAÇÃO DO ANDAR " + i + "----");
  18. System.out.println("Quantida de pessoas: " + qntPessoas);
  19. System.out.print("Informe quantas pessoas entraram: ");
  20. int entraram = sc.nextInt();
  21.  
  22. System.out.print("Informe quantas pessoas sairam: ");
  23. int sairam = sc.nextInt();
  24.  
  25. qntPessoas = qntPessoas + entraram - sairam;
  26.  
  27. if(qntPessoas > 15){
  28. System.out.println("EXCESSO DE PASSAGEIROS. DEVEM SAIR " + (qntPessoas - 15));
  29. }
  30. }
  31.  
  32. System.out.println("Deverão descer " + qntPessoas);
  33.  
  34.  
  35.  
  36. }
  37.  
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement