Advertisement
MladenKarachanov

CatFood

Dec 18th, 2022
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class CatFood {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6. int cats = Integer.parseInt(scanner.nextLine());
  7. double food = Double.parseDouble(scanner.nextLine());
  8. double price = 0;
  9. for (int i = 1; i <= cats; i++) {
  10. int curentNum = Integer.parseInt(scanner.nextLine());
  11. if (food >= 100 && food < 200) {
  12. price = food * 12.45;
  13.  
  14.  
  15. } else if (food >= 200 && food < 300) {
  16.  
  17. price = food * 12.45;
  18.  
  19.  
  20.  
  21. if (food <= 300 && food < 400) {
  22.  
  23. price = 12.45;
  24.  
  25. }
  26. }
  27. System.out.printf("Price for food per day: %.2f lv.");
  28. }
  29. }
  30. }
  31.  
  32.  
  33.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement