Advertisement
veronikaaa86

03. Painting Eggs

Jun 18th, 2022
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. package examPrep;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class P03PaintingEggs {
  6. public static void main(String[] args) {
  7. Scanner scanner = new Scanner(System.in);
  8.  
  9. String size = scanner.nextLine();
  10. String color = scanner.nextLine();
  11. int count = Integer.parseInt(scanner.nextLine());
  12.  
  13. double price = 0;
  14. if (size.equals("Large")) {
  15. if (color.equals("Red")) {
  16. price = 16;
  17. } else if (color.equals("Green")) {
  18. price = 12;
  19. } else if (color.equals("Yellow")) {
  20. price = 9;
  21. }
  22. } else if (size.equals("Medium")) {
  23. if (color.equals("Red")) {
  24. price = 13;
  25. } else if (color.equals("Green")) {
  26. price = 9;
  27. } else if (color.equals("Yellow")) {
  28. price = 7;
  29. }
  30. } else if (size.equals("Small")) {
  31. if (color.equals("Red")) {
  32. price = 9;
  33. } else if (color.equals("Green")) {
  34. price = 8;
  35. } else if (color.equals("Yellow")) {
  36. price = 5;
  37. }
  38. }
  39.  
  40. double totalSum = (count * price) * 0.65;
  41.  
  42. System.out.printf("%.2f leva.%n", totalSum);
  43. }
  44. }
  45.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement