Advertisement
ada1711

Untitled

Jun 2nd, 2024
12
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. public class Bottle
  2. {
  3. public string DrinkType { get; set; }
  4. public int CurrentDrinkAmount { get; set; }
  5.  
  6. public void Drink(int amountToDrink)
  7. {
  8. if (CurrentDrinkAmount < amountToDrink)
  9. {
  10. Console.WriteLine("Not enough drink in the bottle.");
  11. }
  12. else
  13. {
  14. CurrentDrinkAmount -= amountToDrink;
  15. Console.WriteLine($"Just drank {amountToDrink} ml of {DrinkType}.");
  16. }
  17. }
  18.  
  19. public void CheckAmount()
  20. {
  21. Console.WriteLine($"There are still {CurrentDrinkAmount} ml of {DrinkType} in the bottle.");
  22. }
  23. }
  24.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement