fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. System.out.println("Ohoho nice coffee is afforded");
  13.  
  14. int moneyAmount = 10;
  15.  
  16. int espressoPrice = 60;
  17. int americanoPrice = 100;
  18. int waterPrice = 20;
  19. int milkPrice = 40;
  20.  
  21. boolean canbuyanything = false;
  22.  
  23. if(moneyAmount >= espressoPrice)
  24. {
  25. System.out.println("You can buy espresso");
  26. canbuyanything = true;
  27. }
  28.  
  29. if(moneyAmount >= waterPrice)
  30. {
  31. System.out.println("You can buy water");
  32. canbuyanything = true;
  33. }
  34. if(moneyAmount >= milkPrice) {
  35. System.out.println("You can buy milk");
  36. canbuyanything = true;
  37. }
  38.  
  39. if (!canbuyanything) {
  40. System.out.println("Not enough money");
  41. }
  42. }
  43. }
Success #stdin #stdout 0.05s 2184192KB
stdin
Standard input is empty
stdout
Ohoho nice coffee is afforded
Not enough money