New java programmer needs help
I was thinking that my code runs like this
(note that this is just inside jcreator no applets or stuff like that)
Hi you are playing halo 1.9.
Would you like to start or look at the rules(press 1 for rules etc...)?
Would you like to start on ivory tower or ascenion(press 1 for...)
...
My game would be very simple. First i have draw a 2d map with stick figures(\ | / - _) and every box would be numbered. So one would respond in area 1 and you would have choices to move to another area and then you might see and enemy. Note: Most of this game would be text based, very few pix(just of some weapons you pick) and those would still be simple system.out.println statements.
note: Our teacher requires we have 5 classes, two related by inheritance.
SO for my problem: in the place i have put * , i do not know how to go back to the method startGame, since the user input invalid info. In the places I have put ^^, I need to run another method from another class BUT i cannot inherit the method because there is no IS A relationship between my other class. And according to my teacher, inheritance cannot be used without a IS-A relationship. Basically where the ^ are, the program would start the game.
import java.util.Scanner;
public class Greeting {
public String introduction
{
return "Good day, you are playing";
return"H) hh l)L 1)! 9)((( ";
return"H) hh l) 1)!! 9) (( ";
return"H)hhhhhh a)AAAA l) o)OOO 1) 9)(((( ";
return"H) hh a)AAA l) o) OO 1) 9) ";
return"H) hh a) A l) o) OO 1) ** 9) (( ";
return"H) hh a)AAAA l)LL o)OOO 1)!!!!! ## 9)((( ";
return"T)tttttt h) N)n nn t) ";
return" T) h) N)nn nn t)tTTT ";
return" T) h)HHHH e)EEEEE N) nn nn e)EEEEE x) XX t) ";
return" T) h) HH e)EEEE N) nnnn e)EEEE x)X t) ";
return" T) h) HH e) N) nnn e) x)X t) ";
return" T) h) HH e)EEEE N) nn e)EEEE x) XX t)T ";
return" G)gggg ";
return" G) ";
return"G) ggg e)EEEEE n)NNNN ";
return"G) gg e)EEEE n) NN ";
return" G) gg e) n) NN ";
return " G)ggg e)EEEE n) NN ";
}
public String startGame
{
return "Would you like to go over the rules or start playing{enter play to play or rules to examine the rules}";
String playOrRules = in.next;
public void rulesOrgame
{
f (playOrRules.equals "rules")
{
return "you cannont ... ";
}
if (playOrRules.equals "play")
{
^^^^^^^^^^^^
}
else
{
return "That is not a vaild entry. Please try again.";
*******
}
}
}
Sorry this is so long, if anyone read this, i greatly appreciate the effort and time.
If you have any other ideas for my program plz say so, I appreciate any lvl of help.

