0

Java Dice Game

Guys The application should start after logging in to the application. Therefore you should include the user registration option to the application. You can use a menu item for this or simply a button in the application. Registered user information (user id and password) should be stored into a text file (e.g., players.txt) and used while validating users during the log-in. Playing the DiceGame. Player requests to roll the dice. The system presents results: If the dice face value totals seven, the player wins; otherwise, the player loses. You don't need to visualize dice in the game, you may simulate it with two text areas that will display the generated numbers. For each win the player earns 5 points, while player loses 3 points for each defeat. Player scores should also be stored in the players.txt file. This is my java homework i am trying but i cant do . Could u help

19th Aug 2020, 7:49 PM
Hasan Berk
Hasan Berk - avatar
7 ответов
+ 3
In your Login class when the user enter the right username & password add these two lines dispose(); new DiceClass(); This will close your login frame and open your frame in the DiceClass, make sure your frame setVisible is set to true in your DiceClass. (if i understood you right)
20th Aug 2020, 2:28 AM
JavaBobbo
JavaBobbo - avatar
+ 1
because JPasswordField.getText() is deprecated you can use safer import java.util.Arrays; ... char[] password = password_text.getPassword(); String userOK = "user"; char[] passwordOK = {'u','s','e','r'}; if (userName.equals(userOK) && Arrays.equals(password, passwordOK) ) { ... } Arrays.fill(passwordOK,'0');
20th Aug 2020, 4:24 AM
zemiak
+ 1
You are welcome :)
20th Aug 2020, 9:31 PM
JavaBobbo
JavaBobbo - avatar
0
Swapnil i found that from internet . I am trying to do a basic gui with option login or register menu . Then this code can be open if the player press the login then the dice game can be accessable but ı dont know the gui . So ı must do that : when a screen close another screen open . But it is very difficult The code : https://code.sololearn.com/cP0CqlTUgkqm/?ref=app
19th Aug 2020, 8:28 PM
Hasan Berk
Hasan Berk - avatar
0
perhaps you can solve it as text version only without GUI.
19th Aug 2020, 10:42 PM
zemiak
0
JavaBobbo thank u Man :)
20th Aug 2020, 9:48 AM
Hasan Berk
Hasan Berk - avatar
0
zemiak ı dont understand you but ı am very thank u for helping
20th Aug 2020, 9:49 AM
Hasan Berk
Hasan Berk - avatar