Advertisement
barnabe0057

TP Distributeur - Boisson.cs

Feb 23rd, 2022
848
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.49 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace MNS
  8. {
  9.     internal class Boisson
  10.     {
  11.         int quantite;
  12.         string nom;
  13.         int sucre;
  14.         bool lait;
  15.  
  16.         //constructeur
  17.         public Boisson()
  18.         {
  19.             quantite = 0;
  20.             nom = "";
  21.             sucre = 0;
  22.             lait = false;
  23.         }
  24.  
  25.         public Boisson(int initQuantite, string initNom, int initSucre, bool initLait)
  26.         {
  27.             quantite = initQuantite;
  28.             nom = initNom;
  29.             sucre = initSucre;
  30.             lait = initLait;
  31.         }
  32.  
  33.         public void Boire(int quantiteABoire)
  34.         {
  35.             quantite -= quantiteABoire;
  36.         }
  37.  
  38.         public int GetQuantite()
  39.         {
  40.             return quantite;
  41.         }
  42.  
  43.         public void SetQuantite(int newQuantite)
  44.         {
  45.             quantite = newQuantite;
  46.         }
  47.  
  48.         public string GetNom()
  49.         {
  50.             return nom;
  51.         }
  52.  
  53.         public void SetNom(string newNom)
  54.         {
  55.             nom = newNom;
  56.         }
  57.  
  58.         public int GetSucre()
  59.         {
  60.             return sucre;
  61.         }
  62.  
  63.         public void SetSucre(int newSucre)
  64.         {
  65.             sucre = newSucre;
  66.         }
  67.  
  68.         public bool GetLait()
  69.         {
  70.             return lait;
  71.         }
  72.  
  73.         public void SetLait(bool newLait)
  74.         {
  75.             lait = newLait;
  76.         }
  77.     }
  78. }
  79.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement