Question: Im trying to create a word guessing game, im stuck on censoring the word, so that It will show the player how many letters are
Im trying to create a word guessing game, im stuck on censoring the word, so that It will show the player how many letters are in the word, by displaying a series of blanks, having a certain number of wrong guesses. If the player reaches this amount, they will lose the game. but if the player guesses all the letters in the word before running out of wrong guesses, the player will win. The game has to tell the player the total number of wrong guesses left and the current status of the word after each turn. The players game will have correct, incorrect, win, and lose conditions. The player may then choose to replay or quit. The words need to be in an array
import java.io.*;
import java.util.*;
public class WGGame { static void original_main_game() {
String[] cars = {"Volvo", "BMW", "Ford", "Mazda"};
Random ran = new Random();
int r_index_one = (int)(Math.random()*cars.length);
String r_element = cars[r_index_one]; // Censor the word
for (int i = 0; i < cars.length; i++) { r_element += '*'; } }
public static void main(String[] args) { // TODO code application logic here original_main_game(); } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
