Sunday 15 September 2013

How can I create an option menu with while and switch statements?

How can I create an option menu with while and switch statements?

I'm trying to create a menu where you have four options:
You can register a bird you have seen in a textfile.
You can write the type of a bird you have seen.
You can write the place where you have seen the bird.
Close the program
This is what I have done so far:
import easyIO.*;
class Menu {
public static void main(String[] args) {
int counter = 0;
while (counter != 4) {
counter = meny();
switch (counter) {
case 1:
ReigsterBird(1);
break;
case 2:
WriteBirdType(2);
break;
case 3:
WritePlace(3);
break;
case 4:
break;
default:
System.out.println("Give a number between 1 and 4");
}
}
}
But I keep getting these errors, and also i'm not sure how I can solve
this. Is there something i'm missing?
Menu.java:9: error: cannot find symbol
counter = meny();
^
symbol: method meny()
location: class Menu
loop.java:13: error: cannot find symbol
ReigsterBird(1);
^
symbol: method ReigsterBird(int)
location: class Menu
Menu.java:16: error: cannot find symbol
WriteBirdType(2);
^
symbol: method WriteBirdType(int)
location: class Menu
loop.java:19: error: cannot find symbol
WritePlace(3);
^
symbol: method WritePlace(int)
location: class Menu
4 errors
I would appreciate if someone could help out on this so I could create a
menu where you have four options you can choose from.

No comments:

Post a Comment