Advertisement
Spocoman

Painting Eggs

Sep 8th, 2024
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.67 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.         String size = scanner.nextLine(), color = scanner.nextLine();
  7.         int eggCount = Integer.parseInt(scanner.nextLine());
  8.  
  9.         double total =
  10.                 (size.equals("Large") ? (color.equals("Red") ? 16 : color.equals("Green") ? 12 : 9) :
  11.                         size.equals("Medium") ? (color.equals("Red") ? 13 : color.equals("Green") ? 9 : 7) :
  12.                                 (color.equals("Red") ? 9 : color.equals("Green") ? 8 : 5)) * eggCount * 0.65;
  13.  
  14.         System.out.printf("%.2f leva.\n", total);
  15.     }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement