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("Купи булку");
  13.  
  14. int moneyAmount = 5;
  15.  
  16. int halaPrice = 60;
  17. int frenchPrice = 35;
  18. int bublikPrice = 10;
  19.  
  20. boolean canBuyAnything = false;
  21.  
  22. if (moneyAmount >= halaPrice) {
  23. System.out.println("Вы можете купить халу!");
  24. canBuyAnything = true;
  25. }
  26.  
  27. if (moneyAmount >= frenchPrice) {
  28. System.out.println("Вы можете купить французскую булку!");
  29. canBuyAnything = true;
  30. }
  31.  
  32. if (moneyAmount >= bublikPrice) {
  33. System.out.println("Вы можете купить бублик!");
  34. canBuyAnything = true;
  35. }
  36.  
  37. if (canBuyAnything == false) {
  38. System.out.println("Вы можете купить дырку от бублика! Идите работайте!");
  39. }
  40. }
  41. }
Success #stdin #stdout 0.06s 32548KB
stdin
Standard input is empty
stdout
Купи булку
Вы можете купить дырку от бублика! Идите работайте!