daily pastebin goal
82%
SHARE
TWEET

Untitled

PavlinBodurov Dec 26th, 2018 128 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package com.company;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Main {
  6.  
  7.     public static void main(String[] args) {
  8.        Scanner in = new Scanner(System.in);
  9.        double text = in.nextDouble();
  10.        double min = in.nextDouble();
  11.  
  12.         double diffText = Math.abs(text - 20);
  13.         double diffMin = Math.abs(min - 60);
  14.         double priceText = diffText * 0.06;
  15.         double priceMin = diffMin * 0.10;
  16.         double percentText = priceText * 0.20;
  17.         double percentMin = priceMin * 0.20;
  18.         double totalPercent = percentText + percentMin;
  19.         double totalPriceText = priceText + percentText;
  20.         double totalPriceMin = priceMin + percentMin;
  21.         double totalPrice = totalPriceMin + totalPriceText + 12.00;
  22.  
  23.         if (text > 20 && min > 60) {
  24.             System.out.printf("%.0f additional messages for %.2f levas%n%.0f additional minutes for %.2f levas%n%.2f additional taxes%n%.2f total bill"
  25.                     , diffText, priceText, diffMin, priceMin, totalPercent, totalPrice);
  26.  
  27.         } else if (text <= 20 && min > 60) {
  28.             totalPrice = priceMin + percentMin + 12.00;
  29.             System.out.println("0 additional messages for 0.00 leva");
  30.             System.out.printf("%.0f additional minutes for %.2f levas%n%.2f additional taxes%n%.2f total bill",diffMin,priceMin,percentMin,totalPrice);
  31.  
  32.         } else if (text > 20 && min <= 60) {
  33.             totalPrice = priceText + percentText + 12.00;
  34.             System.out.printf("%.0f additional messages for %.2f levas%n0 additional minutes for 0.00 levas%n%.2f additional taxes%n%.2f total bill",
  35.                     diffText, priceText, percentText, totalPrice);
  36.  
  37.         } else {
  38.             System.out.println("0 additional messages for 0.00 levas");
  39.             System.out.println("0 additional minutes for 0.00 levas ");
  40.             System.out.println("0.00 additional taxes");
  41.             System.out.println("12.00 total bill");
  42.         }
  43.  
  44.     }
  45. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top