SHARE
TWEET

Untitled

pashunov151 Apr 5th, 2019 103 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.util.List;
  2. import java.util.Scanner;
  3.  
  4. public class Test {
  5.     public static void main(String[] args) {
  6.         Scanner scanner = new Scanner(System.in);
  7.         int freeMins = 60;
  8.         int freeMessages = 20;
  9.         int additionalMess = scanner.nextInt();
  10.         int additional = scanner.nextInt();
  11.         double additionalMins = (additional - freeMins);
  12.         double additionalMinsTax = (additional - freeMins) * 0.10;
  13.         double additionalMessages = (additionalMess - freeMessages);
  14.         double additionalMessagesTax = (additionalMess - freeMessages) * 0.06;
  15.         double sumPercent = (additionalMinsTax + additionalMessagesTax) * 0.2;
  16.         double totalBill = 12 + additionalMessagesTax + additionalMinsTax + sumPercent;
  17.         double totalBillNoMessages = additionalMessagesTax + additionalMinsTax + sumPercent;
  18.         if (additionalMess <= 20 && additional <= 60) {
  19.             System.out.println("0 additional messages for 0.00 levas");
  20.             System.out.println("0 additional minutes for 0.00 levas");
  21.             System.out.println("0.00 additional taxes");
  22.             System.out.println("12.00 total bill");
  23.         } else if (additionalMess > 20 && additional > 60) {
  24.             System.out.printf("%.0f additional messages for %.2f levas",
  25.                     additionalMessages, additionalMessagesTax);
  26.             System.out.printf("%n%.0f additional minutes for %.2f levas", additionalMins, additionalMinsTax);
  27.             System.out.printf("%n%.2f additional taxes", sumPercent);
  28.             System.out.printf("%n%.2f total bill", totalBill);
  29.         }else if (additionalMess <=20 && additional > 60){
  30.             System.out.print("0 additional messages for 0.00 levas");
  31.             System.out.printf("%n%.0f additional minutes for %.2f levas", additionalMins, additionalMinsTax);
  32.             System.out.printf("%n%.2f additional taxes", sumPercent);
  33.             System.out.printf("%n%.2f total bill", totalBillNoMessages);
  34.         }else {
  35.             System.out.printf("%.0f additional messages for %.2f levas%n",
  36.                     additionalMessages, additionalMessagesTax);
  37.             System.out.print("0 additional minutes for 0.00 levas");
  38.             System.out.printf("%n%.2f additional taxes", sumPercent);
  39.             System.out.printf("%n%.2f total bill", totalBill);
  40.         }
  41.  
  42.  
  43.     }
  44. }
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