Hi guys. I just having a little problem about creating a good console GUI for our homework. My program is just a simple shopping cart program where in we were asked to create a GUI that asks for the user if he is either a ADMIN user or a CLERK user. I made the features of it work already, but I don't know how to loop back again to my "main screen" after an action has been done by the user.
In other words, the user could only process one action per execution of my program. Here's a scenario for example, let's say the user is an ADMIN and he wants to ADD ITEM: MAIN SCREEN->ADMIN USER->ADD ITEM->EXIT THE PROGRAM. In this case, the user has no choice but to run the program again.
I want it to be: MAIN SCREEN->ADMIN USER->ADD ITEM->MAIN SCREEN AGAIN. In this case, the user is given a choice of adding another item or exiting the program after adding an item already
Here's part of the code from what I've done so far:
Admin ad = new Admin();
Scanner s = new Scanner(System.in);
//my "main screen"
System.out.println("Press  to CREATE an Item. Press  to REMOVE Item. Press  UPDATE Item. Press  to EXIT");
int choice = s.nextInt();
System.out.println("Enter item ID: ");
int itemId = s.nextInt();
System.out.println("Enter item Name: ");
String itemName = sc.nextLine();
System.out.println("Enter item Price: ");
int itemPrice = s.nextInt();
ad.AddItem(itemId, itemPrice, itemName);
Hope you could help guys :)
P.S. I also did this in an if-else pattern. But I think doing it in a switch is better..