Advertisement
Guest User

Untitled

a guest
Feb 21st, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.68 KB | None | 0 0
  1. package fr.cfai.cafe.business;
  2.  
  3. import java.util.ArrayList;
  4.  
  5. public class Client {
  6.  
  7. // Métaphore du mille-feuille
  8. // Choix du paquetage
  9. // On déclare les attributs privés
  10. // On génère le ou les constructeurs
  11. // On génère les accesseurs et mutateurs (getters et setters)
  12. // On génère la méthode toString
  13.  
  14. private int id;
  15. private String nom;
  16. private float argent;
  17. private Paiement paiement;
  18. private ArrayList <Boisson> boissonsConsommees;
  19. private static int compteur = 0;
  20.  
  21. public Client() {
  22. id = ++compteur;
  23. }
  24.  
  25. public Client(String nom, float argent, Paiement paiement) {
  26. this();
  27. this.nom = nom;
  28. this.argent = argent;
  29. this.paiement = paiement;
  30. }
  31.  
  32. // Getter & Setter id
  33. public int getId() {
  34. return id;
  35. }
  36. public void setId(int id) {
  37. this.id = id;
  38. }
  39.  
  40. // Getter & Setter nom
  41. public String getNom() {
  42. return nom;
  43. }
  44. public void setNom(String nom) {
  45. this.nom = nom;
  46. }
  47.  
  48. // Getter & Setter argent
  49. public float getArgent() {
  50. return argent;
  51. }
  52. public void setArgent(float argent) {
  53. this.argent = argent;
  54. }
  55.  
  56. // Getter & Setter paiement
  57. public Paiement getPaiement() {
  58. return paiement;
  59. }
  60. public void setPaiement(Paiement paiement) {
  61. this.paiement = paiement;
  62. }
  63.  
  64. // Getter & Setter BoissonsConsommees
  65. public ArrayList<Boisson> getBoissonsConsommees() {
  66. return boissonsConsommees;
  67. }
  68. public void setBoissonsConsommees(ArrayList<Boisson> boissonsConsommees) {
  69. this.boissonsConsommees = boissonsConsommees;
  70. }
  71.  
  72.  
  73. // toString
  74. @Override
  75. public String toString() {
  76. return "Client [id=" + id + ", nom=" + nom + ", argent=" + argent + ", paiement=" + paiement + "]";
  77. }
  78.  
  79. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement