WeMo Connect

Setup Menus in Admin Panel

Example counselor

import java.util.Scanner;

public class Counselor {

static int menu()

{

Scanner input = new Scanner (System.in);

String choice = “0”;

int mychoice = 0;

System.out.printf(“\nMENU”);

System.out.printf(“\n0. DONE”);

System.out.printf(“\n1. Math1”);

System.out.printf(“\n2. English”);

System.out.printf(“\n3. Chem1”);

System.out.printf(“\nYOUR CHOICE: “);

choice = input.next();

System.out.printf(“\nString Value : %s”, choice);

mychoice = Integer.valueOf(choice).intValue();

System.out.printf(“\nint Value = %d”, mychoice);

return mychoice;

}

public static void main(String[] args) {

int result = -1;

int choice1 = -1;

int choice2 = -1;

for ( ; (result != 0) && (choice1 <= 0 || choice2 <= 0) ; )

{

System.out.printf(“\n —– DEBUG: choice1 = %d choice2 = %d”, choice1, choice2);

result = menu();

System.out.printf(“\nRESULT = %d”, result);

switch (result )

{

case 0: System.out.println(“\nDONE”); break;

case 1:

case 2:

case 3:

System.out.println(“\nGOOD CHOICE”);

if (choice1 <= 0)

{

choice1 = result;

}

else

{

if ((choice1 > 0) && (choice2 <= 0))

choice2 = result;

}

break;

default:

System.out.println(“\nERROR: Invalid choice – your choices are 0,1,2,3 – thanks!”);

}

}

System.out.println(“\n—– DONE —— \n”);

System.out.println(“\n—– RESULT —— \n”);

if ((choice1 == 1) && (choice2 == 2))

{

System.out.println(“………………………  Go for — CHEM1  ……………………… “);

}

if ((choice1 == 1) && (choice2 == 3))

{

System.out.println(“………………………  Go for — ENGLISH  ……………………… “);

}

if ((choice1 == 2) && (choice2 == 3))

{

System.out.println(“………………………  Go for — MATH1 ……………………… “);

}

System.out.println(“\n—– DONE —— \n”);

}

}

December 31, 2014

0 Responses on Example counselor"

    Leave a Message

    Your email address will not be published. Required fields are marked *