Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Arrays;
- import java.util.Scanner;
- import java.util.*;
- import java.lang.*;
- import java.io.*;
- public class Jogo {
- private String nome;
- private int level = 1;
- private String objetivo = "// ------------------------------------------------ \n\nOla, seu objetivo é acertar a palavra senha \nno menor número de tentativas possÃvel.\n\n--------------------------------------------------//\n";
- 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";
- private String tentativa;
- public String[] senha = {"PUBLIC"};
- public String tabuleiro = "*****";
- private boolean acertou;
- public int erros = 0;
- public void setNome(String nome) {
- this.nome = nome;
- }
- public void setObj(String objetivo) {
- this.objetivo = objetivo;
- }
- public void setCat(String categoria) {
- this.categoria = categoria;
- }
- public void setTentativa(String tentativa) {
- this.tentativa = tentativa;
- }
- public String getTentativa() {
- return tentativa;
- }
- public void setTabuleiro(String tabuleiro) {
- this.tabuleiro = tabuleiro;
- }
- public String getTabuleiro() {
- return tabuleiro;
- }
- public String getNome() {
- return nome;
- }
- public String getObj() {
- return objetivo;
- }
- public String getCat() {
- return categoria;
- }
- public void verificaAcerto() {
- for (int i=0; i < 5; i++) {
- if (senha[i].equals(getTentativa())) {
- setTabuleiro(tentativa[i]);
- } else {
- erros++;
- break;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment