Advertisement
Guest User

Untitled

a guest
Sep 25th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.25 KB | None | 0 0
  1. int choix_debut;
  2. Compte c = null;
  3. int id_compte;
  4. do
  5. {
  6. System.out.println("Choisissez une opération [1/2/3]");
  7. System.out.println("1: Choisir un Compte ");
  8. System.out.println("2: Créer Compte ");
  9. choix_debut = sc.nextInt();
  10.  
  11. if (choix_debut == 1)
  12. {
  13. do
  14. {
  15. System.out.println("Entrez id compte");
  16. id_compte = sc.nextInt();
  17. c = cl.select_compte(id_compte);
  18. }while(cl == null);
  19. break;
  20. }
  21.  
  22. else if (choix_debut == 2)
  23. {
  24. c = cl.add_compte();
  25. break;
  26. }
  27.  
  28. }while(choix_debut!=3);
  29.  
  30.  
  31.  
  32. do // fait -- tant que le choix est different de 4
  33. {
  34. System.out.println("Choisissez une opération [1/2/3/4]");
  35. System.out.println("1: Operations Bancaires ");
  36. System.out.println("2: Consulter Compte ");
  37. System.out.println("3: Creer Compte ");
  38. System.out.println("4: Sortir ");
  39. choix = sc.nextInt();
  40. if (choix == 1) // si le choix = 1 alors propose des operations bancaires
  41. {
  42. do // fait -- tant que le choix est different de 4
  43. {
  44. System.out.println("Choisissez une opération bancaire [1/2/3/4]");
  45. System.out.println("1: Retrait");
  46. System.out.println("2: Virement");
  47. System.out.println("3: Depot");
  48. System.out.println("4: Retour");
  49.  
  50. choix_operation = sc.nextInt(); // l'utilisateur rentre son choix sous forme d int
  51. switch (choix_operation)
  52. {
  53. case 1: c.retrait();
  54. break;
  55. case 2: //c.virement();
  56. break;
  57. case 3: c.depot(); // appel la fonction depot
  58. break;
  59. }
  60.  
  61. } while (choix_operation != 4);
  62. }
  63. else if (choix == 2)
  64. System.out.println("Votre solde est de " + c.get_solde() + "euro "); //affiche le solde du compte en faisant appel a la fonction get_solde
  65.  
  66. else if (choix==3)
  67. {
  68. System.out.println("choisissez un type de compte");
  69. c = cl.add_compte();
  70. }
  71.  
  72. } while (choix!=4 );
  73. System.out.println("A bientot ");
  74.  
  75. sc.close();
  76. }
  77.  
  78.  
  79. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement