Advertisement
Guest User

Untitled

a guest
Jun 24th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.80 KB | None | 0 0
  1. package pb1;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class FreeNedelq {
  6.     public static void main(String[] args) {
  7.         Scanner scanner = new Scanner(System.in);
  8.  
  9.         int pictures = Integer.parseInt(scanner.nextLine());
  10.         String picturesType = scanner.next();
  11.         String purchase = scanner.nextLine();
  12.         double priceForOne = 0.0;
  13.         double wholePrice = 0.0;
  14.         double sale = 0.0;
  15.         if (purchase.equals("online")) {
  16.             if (picturesType.equals("9X13") && pictures >= 50) {
  17.                 priceForOne = 0.16;
  18.                 sale = 0.02;
  19.                 wholePrice = (priceForOne * pictures) * 0.95;
  20.             } else if (picturesType.equals("10X15") && pictures >= 80) {
  21.                 priceForOne = 0.16;
  22.                 wholePrice = (priceForOne * pictures) * 0.97;
  23.             } else if (picturesType.equals("13X18") && pictures >= 100) {
  24.                 priceForOne = 0.38;
  25.                 wholePrice = (priceForOne * pictures) * 0.95;
  26.             } else if (picturesType.equals("13X18") && pictures >= 50 && pictures <= 100) {
  27.                 priceForOne = 0.38;
  28.                 wholePrice = (priceForOne * pictures) * 0.97;
  29.             } else if (picturesType.equals("20X10") && pictures > 50) {
  30.                 priceForOne = 2.90;
  31.                 wholePrice = (priceForOne * pictures) * 0.91;
  32.             } else if (picturesType.equals("20X10") && pictures >= 10 && pictures <= 50) {
  33.                 priceForOne = 2.90;
  34.                 wholePrice = (priceForOne * pictures) * 0.93;
  35.             }
  36.         }
  37.         if (purchase.equals("offline")) {
  38.             if (picturesType.equals("9X13") && pictures >= 50) {
  39.                 priceForOne = 0.16;
  40.                 sale = 1;
  41.                 wholePrice = (priceForOne * pictures) * 0.95;
  42.             } else if (picturesType.equals("10X15") && pictures >= 80) {
  43.                 priceForOne = 0.16;
  44.                 wholePrice = (priceForOne * pictures) * 0.97;
  45.             } else if (picturesType.equals("13X18") && pictures >= 50 && pictures <= 100) {
  46.                 priceForOne = 0.38;
  47.                 wholePrice = (priceForOne * pictures) * 0.97;
  48.             } else if (picturesType.equals("20X10") && pictures >= 10 && pictures <= 50) {
  49.                 priceForOne = 2.90;
  50.                 wholePrice = (priceForOne * pictures) * 0.93;
  51.             } else if (picturesType.equals("20X10") && pictures > 50) {
  52.                 priceForOne = 2.90;
  53.                 wholePrice = (priceForOne * pictures) * 0.91;
  54.             } else if (picturesType.equals("13X18") && pictures >= 100) {
  55.                 priceForOne = 0.38;
  56.                 wholePrice = (priceForOne * pictures) * 0.95;
  57.             }
  58.         }
  59.         double result = wholePrice * sale;
  60.         System.out.printf("%.2fBGN", result );
  61.     }
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement