Guest User

Jogo.java

a guest
Nov 8th, 2016
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.75 KB | None | 0 0
  1. import java.util.Arrays;
  2. import java.util.Scanner;
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. public class Jogo {
  8.  
  9.     private String nome;
  10.     private int level = 1;
  11.     private String objetivo = "// ------------------------------------------------ \n\nOla, seu objetivo é acertar a palavra senha \nno menor número de tentativas possível.\n\n--------------------------------------------------//\n";
  12.     private String categoria = "\n\n\nCATEGORIA: PALAVRAS RESERVADAS DO JAVA\n\nQUANTIDADE MAXIMA DE TENTATIVAS ERRADAS: 15\n\nLETRAS NA PALAVRA SENHA: 6\n\n";
  13.     private String tentativa;
  14.     public String[] senha = {"PUBLIC"};
  15.     public String tabuleiro = "*****";
  16.     private boolean acertou;
  17.     public int erros = 0;
  18.  
  19.  
  20.  
  21.  
  22.     public void setNome(String nome) {
  23.       this.nome = nome;
  24.     }
  25.  
  26.     public void setObj(String objetivo) {
  27.       this.objetivo = objetivo;
  28.     }
  29.  
  30.     public void setCat(String categoria) {
  31.       this.categoria = categoria;
  32.     }
  33.  
  34.     public void setTentativa(String tentativa) {
  35.       this.tentativa = tentativa;
  36.     }
  37.    
  38.     public String getTentativa() {
  39.       return tentativa;
  40.     }
  41.    
  42.    
  43.     public void setTabuleiro(String tabuleiro) {
  44.     this.tabuleiro = tabuleiro;
  45.     }
  46.    
  47.     public String getTabuleiro() {
  48.     return tabuleiro;
  49.     }
  50.    
  51.  
  52.  
  53.  
  54.    
  55.     public String getNome() {
  56.       return nome;
  57.     }
  58.  
  59.     public String getObj() {
  60.       return objetivo;
  61.     }
  62.  
  63.     public String getCat() {
  64.       return categoria;
  65.     }
  66.  
  67.  
  68.  
  69.  
  70.  
  71.     public void verificaAcerto() {
  72.        
  73.        
  74.         for (int i=0; i < 5; i++) {
  75.            
  76.             if (senha[i].equals(getTentativa())) {
  77.                 setTabuleiro(tentativa[i]);            
  78.                
  79.             } else {
  80.                 erros++;
  81.                 break;
  82.             }
  83.            
  84.     }
  85.   }
  86.  
  87.  
  88.  
  89. }
Advertisement
Add Comment
Please, Sign In to add comment