hi guys i need help with my project. I am a beginner in Java programming,and recently I came across a project, i am having problem at the start...so i need some guide to tell me how i should do(the steps).
My project required us to do a word game that played by 2 players. Every player is given 5 random letters, in this 10 letter, at least 2 of the letters are vowels. The letters can appear more than once.
The program must be able to:
1)check there is such a word and
2)ensure that the word is form only from the letter given.
3)If it is invalid, must show the reason.
4)The player have a chance to try again if the word is invalid unless he/she skip his/her turn.
5)Able to display the score obtain for valid word form by each player.
6)Each letter in this game is assigned a numerical value, similar to Scrabble.(for score)
7)the score will be zero if any player skip their turn.
8) An accumlation of total score of each player at the end of the game is needed.
9) The game will stop and display the score of both players if the player decided to quit.
A example of output:
Hello!WordGame
Letters of player 1 : a c f h i n p r s w
Enter your word (or ‘@’ to pass or ‘!’ to quit) : saw
Total score for word : 6
Total score for game : 6
Letters of player 2 : b c e g n n o t x z
Enter your word (or ‘@’ to pass or ‘!’ to quit): bench
Error : A valid word is formed but one or more letter(s) used are not yours
Enter your word (or ‘@’ to pass or ‘!’ to quit): benc
Error : An invalid word is formed
Enter your word (or ‘@’ to pass or ‘!’ to quit): bet
Total score for word : 5
Total score for game : 5
Letters of player 1 : c e f g h i n p r t
Enter your word (or ‘@’ to pass or ‘!’ to quit): @
Total score for word : 0
Total score for game : 6
Letters of player 2 : a c i g n n o v x z
Enter your word (or ‘@’ to pass or ‘!’ to quit): gain
Total score for word : 5
Total score for game : 10
Letters of player 1 : c e f g h i n p r t
Enter your word (or ‘@’ to pass or ‘!’ to quit): !
Total score for player 1: 6
Total score for player 2: 10
Player 2 won!
****** we are given a dictionary.jar file and a word.txt file.... I have import the dictionary.jar file but i do not know what to do with the word.txt file.
below is the code i have so far.....it seems wrong and i know i am quite poor with this.. the due date is not to far from now:(
import java.util.Random;
import java.util.Scanner;
public class Assignment_1{
public static void main(String[] args) {
String[]dict = FileUtil.readDictFromFile("words.txt");
// Make sure words.txt is in the root of your project folder(i do not understand this)
String[] player = {"player1","player2"};
}
}
i really need someone to guide me in completing this project. Thank You!