1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
| import java.util.Scanner;
public class Pirate {
static Scanner sc = new Scanner(System.in);
public static void main(String[] args) {
int n;
do{
System.out.println("******* MENU ******");
System.out.println("1 - Ajouter une relation");
System.out.println("2 - Fin");
System.out.print("Votre choix ? ");
menu = sc.nextInt();
switch(menu){
case 1 : ajoutRelation();
}
}while(menu != 2);
}
public static void ajoutRelation() {
int choix;
char A, B, C, D;
do{
System.out.println("***** UtilMath - interface *****");
System.out.println("Menu");
System.out.println("1 - échanger objets");
System.out.println("2 - afficher coût");
System.out.println("3 - fin");
System.out.print("Votre choix ? ");
choix = sc.nextInt();
switch(choix) {
case 1 : System.out.print("nom de pirate 1 = ? ");
A = sc.nextLine();
System.out.print("nom de pirate 2 = ? ");
B = sc.nextLine();
System.out.println( "Resultat = " + echanger_objet(A, B));
break;
case 2 : System.out.print("numero = ? ");
a = sc.nextInt();
System.out.println( "Resultat = " + afficher_cout(a) );
break;
}
}while( choix != 3);
} // interfaceMath()
}// Class |
Partager