I need help with my code for computers, our final assignment is to make a simple game, so I decided to do Hangman. This assignment is worth 20% of my final mark due on Monday so if anybody could help me with it I would really appreciate it. (I'm still in high school and its just basic programming, so the code doesn't really need to be fancy as long as it works properly). The only thing I got to work were the lines, then everything else is just a huge mess.
class hangMan
{
public static void main (String[] args)
{
String s = secretWord();
int chances = 10;
for (chances = 10; chances <= 10;)
{
System.out.println("The secret word is: " );
printLines(" _ ",s.length());
System.out.println("Enter a letter");
char letter = In.getChar();
letterChecking();
if(letterChecking()==true)
{
letterSwap([letter]);
}else
{
chances--;
System.out.println("You have " + chances + " left.");
}
}
if (chances > 0)
{
System.out.println("Congratulations the secret word is " + secretWord());
}else
{
System.out.println("Sorry you lose, the secret word is " + secretWord());
}
}
public static String secretWord()
{
System.out.println("What is the secret word");
String secretWord = In.getString();
return secretWord;
}
public static void printLines(String symbole, int width)
{
String s = secretWord();
for (int w = 1; w <= s.length(); w++)
{
System.out.print(symbole);
}
System.out.println();
}
public static boolean letterChecking()
{
String s = secretWord();
char letter;
s.equalsIgnoreCase(secretWord());
for (s.charAt(letter);;)
{
if (s.charAt(letter)== s.length())
{
return true;
}else
{
}
}
}
public static void letterSwap(char [] String)
{
int location = -1;
String s = secretWord();
char letter;
char temp;
for(char i; i < s.charAt(letter); i++)
{
if (String [letter] == s.charAt(letter))
{
location = s.charAt(letter);
{
if (i >= 0)
{
temp = String[i-1];
String[i-1] = String[i];
String[i] = temp;
}
System.out.println("The secret word is: " );
printLines(" _ ",s.length());
}
}
}
}
}