Advertisement
Viniciusfelbs

Questão 4 lista 6

Oct 31st, 2019
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.94 KB | None | 0 0
  1. package lista;
  2.  
  3. import java.util.Scanner;
  4.  
  5. class Racas {
  6.  
  7.     private String raca;
  8.     private int moral;
  9.     private Racas proximo;
  10.  
  11.     public Racas() {
  12.         this.raca = null;
  13.         this.moral = 0;
  14.         this.proximo = null;
  15.     }
  16.  
  17.     public void inserir(String raca, int moral) {
  18.         if (this.proximo == null) {
  19.             this.raca = raca;
  20.             this.moral = moral;
  21.             this.proximo = new Racas();
  22.         } else {
  23.             this.proximo.inserir(raca, moral);
  24.         }
  25.     }
  26. }
  27.  
  28. public class HuxleyCode {
  29.  
  30.     public static void main(String[] args) {
  31.         Scanner s = new Scanner(System.in);
  32.         String raca = "";
  33.         int moral;
  34.         while (!raca.equals("----------")) {
  35.             raca = s.nextLine();
  36.             moral = s.nextInt();
  37.         }
  38.         while (s.hasNext()) {
  39.             String discurso = "";
  40.             discurso += s.nextLine();
  41.         }
  42.  
  43.     }
  44.  
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement