Reputation: 23
So I am a beginner to the Java world, I know some syntax and can make simple programs but that is about it. So I have an assignment which is 90% complete. Its a bookstore with the options Register - Sign in - View Books - View Purchase History. I have completed these but the one I am stuck on is the administrative capabilites.
What was asked of us was if someone signs in using the admin username then 2 more options in the menu should become visible. So as it stands it would be pretty much like this.
In my Sign in method after the user enters in the username I figure do a If(username!="admin") "Continue as a normal user" else display original menu with the 2 new menus like so
So my problem is how to hide these 2 options or display them when an admin signs in.
Now I do not want anyone to do this for me, but any type of guidence would be great.
Thanks in advance.
Brandon
Upvotes: 0
Views: 144
Reputation: 7905
something along the lines of this
if(username.equals("admin")) {
System.out.println("option 6");
System.out.println("option 7");
}
Essentially you're checking if someone is an admin and if they are then you give them the extra options. You will have to make sure though when you are actually getting the user input that they don't enter one of the admin options though. Just because the menu doesn't display it doesn't mean you don't have to check for it.
Upvotes: 3