i want this to loop so that i can print until if(loop==3) sop(exit);
String[] item ={"[1]hotdog", "[2]eggpie","[3]menudo","[4]pizza","[5]lumpia"};
int[] cost = {5, 10, 15, 20, 25};
int[] selling = {10,15,20,25,30,};
int[] qty = {2,4,6,8,10};
for (int i = 0; i < item.length; i++)
{
System.out.println(" "
+item[i]+"\t"+cost[i]+"\t\t"+selling[i]+"\t\t"+qty[i]);
}
System.out.print("Item you want to add to list: ");
int item2 = sc.nextInt();
System.out.println("list: "+item2);
System.out.print("how many do you want: ");
int qty2 = sc.nextInt();
System.out.println("list:"+item2 + "["+qty2+"]");
System.out.println("[1]add more");
System.out.println("[2]show list");
System.out.println("[3]exit");
System.out.print("choose number:");
int loop = sc.nextInt();
if(loop==1){
System.out.print(return to choices);
if(loop==2){
System.out.print(shows item(not array.list));
if(loop==3){
System.out.print(exit);
anyone help for looping and i dont know if on my scanner part it is fault
or not. im just using basic im at my first year in programming please i
need basic
No comments:
Post a Comment