Neeed help debugging this package testFix; import java.util.Random; public class
ID: 644285 • Letter: N
Question
Neeed help debugging this
package testFix;
import java.util.Random;
public class methods {
static void restOfStory(){
JOptionPane.showMessageDialog(20,"O Thank you my friend. Please come with me");
JOptionPane.showMessageDialog(null,"You follow the man to his special tree. It had a small glow to it.");
JOptionPane.showmessageDialog(null,"He pushes you into the tree and you get transported to another world. Next to you, you see a sword.");
int pickUpSword = JOptionPane.showConfirmDialog(null, "Pick it up?", "Sword", JOptionPane.YES_NO_OPTION);
if (pickUpSword == joptionPane.YES_OPTION) {
swordPickUp();
JOpinionPane.showMessageDialog(null,"You felt great about the defeat. but the golory faded as people came running towards you");
JOptionPane.showMessageDialog(null,"You killed our pet! He was mearly just welcoming you to the town!. The towns folk grabbed onto you and hangs you.");
gameOver();
}
else {
laeveSword();
}
}
static void swordPickUp(){
JOptionPane.showMessageDialog(null,"A creature shows up. It begins to attack!");
int creatureHealth == 10;
while(creatureHealth >= 0);{
JOptionPane.showMessageDialog(null,"Attack!");
JOptionPane.showMessageDialog(null,"Health: " + creaturesHealth);
--creatureHealth;
}
JOptionPane.showMessageDialog(null,'You defeated the creature!");
return 0;
}
static void leaveSword(){
int runForrest;
JOptionPane.showMessageDialog(null,'Come to find out the creature was the towns pet and it was mearly greeting you. You feel relieved.");
JOptionPane.showMessageDilog(null,"The towns folk showed up to greet you. They want to throw a party!");
int joinParty = JOptionPane.showConfirmDialog(null, "Join the Party?", "DO IT MEOW!", JOptionPane.YES_NO_OPTION);
if (runForrest == JOptionPane.YES_OPTION) {
party();
JOptionPane.showMessageDialog(null,"You gained their trust, and you got transported back to the old man.");
JOptionPane.showMessageDialog(null,"Thank you for everything and the man disappeared");
youWon();
}
else {
JOptionPane.showMessageDialog(null,"You have angered the town's people! They Attack!");
int youRun = JOptionPane.showConfirmDialog(null, "Join the Party?", "DO IT MEOW!", JOptionPane.YES_NO_OPTION);
if (youRun == JOptionPane.YES_OPTION) {
party();
}
else {
JOptionPane.showMessageDialog(null,"They killed you");
gameOver();
}
}
}
static void Party(){
String result = JOptionPane.showInputDialog(null, "How many beers will you drink? choose between 0-4:");
int result = Integer.parseInt(result);
switch(result2){
case 0:
JOptionPane.showMessageDialog(null,"You angered the people!");
gameOver();
break;
case 1:
JOptionPane.showMessageDialog(null,"You have pleased them but they grow to dislike you");
disLikeYou();
break;
case 2
JOptionPane.showMessageDialog(null,"They love you already!");
break;
case 3:
JOptionPane.showMessageDialog(null,"They Egg you on to drink more")
break;
case 4;
JOptionPane.showMessageDialog(null,"you have drank to much, but they still love you");
break;
default:
JOptionPaneshowMessageDialog(null,"You are to drunk and you have annoyed them./nThey grew angry.");
gameOver();
break;
}
return;
}
static void disLikeYou(){
JOptionPane.showMessageDialog(null,"One man brought you to the back of the pub and asked you a question);
String yourGuess = JOptionPane.showInputDialog(null, "Choose a number greater than what I am thinking.");
int yourGuess2 = Integer.parseDouble((int)yourGuess);
Random rand = new Random();
int randomNum = rand.nextInt(20) + 5;
if(yourGuess2 >= randomNumber){
JOptionPane.showMessageDialog(null,"You got it! You are now on the peoples good side");
return;
}else{
JOptionPane.showMessageDialog(null,"You failed the test and he stabbed you.");
gameOver();
}
}
static void gameOver(){
JOptionPane.showMessageDialog(null,"Game Over Man game Over!");
System.exit(0);
}
static void youWon(){
JOptionPane.showMessageDialog(null,"Congrats you won!");
System.exit(0);
}
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
And this as well.
package testFix;
import javax.swing.JOptionPane;
public class Main {
public static void main(String[] args){
JOptionPane.showMessageDialog(null,"This is going to be hard, Good Luck!);
JOptionPane.showMessageDialog(null,"So this is going to be a Choose Your own Adventure Story You will have to choose the path");
JOptionPane.showMessageDialog(null,"You are walking a path, a scary path. The Wind Hollowing through the trees. You come to a man sitting on the ground")
JOptionPane.showMessageDialog(null,"Young warrior will you help me?");
int reply = JOptionPane.showConfirmDialog(null, "Will you help?, "Help me warrior", JOptionPane.YES_NO_OPTION);
if (reply == JOptionPane.YES_OPTION) {
.restOfStory();
}
else {
JOptionPane.showMessageDialog(null, "Die!");
JOptionPane.showMessageDialog(null`"He attacks you and you fall to the ground Your life was ended.")
Methods.gameover();
}
}
}
Explanation / Answer
HI you can find these errors I am showing you with line numbers
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.