Advertisement
Guest User

Untitled

a guest
Sep 7th, 2017
322
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.60 KB | None | 0 0
  1. package ivan;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class _03_Megapixels {
  6.     public static void main(String[] args) {
  7.         Scanner console = new Scanner(System.in);
  8.  
  9.         int countFotos = Integer.parseInt(console.nextLine());
  10.         String type = console.nextLine();
  11.         String typeOfOrder = console.nextLine();
  12.  
  13.         double onePeicePrize = 0;
  14.         double countDiscount = 1;
  15.  
  16.  
  17.         switch (type) {
  18.             case "9X13":
  19.                 onePeicePrize = 0.16;
  20.                 if (countFotos >= 50) {
  21.                     countDiscount = 0.95;
  22.                 }
  23.                 break;
  24.             case "10X15":
  25.                 onePeicePrize = 0.16;
  26.                 if (countFotos >= 80) {
  27.                     countDiscount = 0.97;
  28.                 }
  29.                 break;
  30.             case "13X18":
  31.                 onePeicePrize = 0.38;
  32.                 if (countFotos >= 50 && countFotos <= 100) {
  33.                     countDiscount = 0.97;
  34.                 } else if (countFotos > 100) {
  35.                     countDiscount = 0.95;
  36.                 }
  37.                 break;
  38.             case "20X30":
  39.                 onePeicePrize = 2.90;
  40.                 if (countFotos >= 10 && countFotos <= 50) {
  41.                     countDiscount = 0.93;
  42.                 } else if (countFotos > 50) {
  43.                     countDiscount = 0.91;
  44.                 }
  45.                 break;
  46.         }
  47.         double sum = countFotos * onePeicePrize * countDiscount;
  48.  
  49.         if (typeOfOrder.equals("online")) {
  50.             sum *= 0.98;
  51.         }
  52.         System.out.printf("%.2fBGN", sum);
  53.     }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement