Advertisement
Guest User

Untitled

a guest
May 2nd, 2020
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.66 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4.     public static void main(String[] args) {
  5.  
  6.         Scanner userInput = new Scanner(System.in);
  7.  
  8.         int textMessages = userInput.nextInt();
  9.         double minutes = userInput.nextDouble();
  10.  
  11.         int additionalMessages = textMessages - 20;
  12.         double additionalMinutes = minutes - 60;
  13.  
  14.         double priceAdditionalMessages = additionalMessages * 0.06;
  15.         double priceAdditionalMinutes = additionalMinutes * 0.10;
  16.  
  17.         if ((additionalMessages > 0) && (additionalMinutes) > 0) {
  18.             System.out.printf("%d additional messages for %.2f levas %n", additionalMessages, priceAdditionalMessages);
  19.             System.out.printf("%.0f additional minutes for %.2f levas %n", additionalMinutes, priceAdditionalMinutes);
  20.  
  21.             double priceAdditionalTaxes = 0.20 * (priceAdditionalMessages + priceAdditionalMinutes);
  22.             double totalBill = 12.00 + 1.20 * (priceAdditionalMessages + priceAdditionalMinutes);
  23.  
  24.             System.out.printf("%.2f additional taxes %n", priceAdditionalTaxes);
  25.             System.out.printf("%.2f total bill", totalBill);
  26.         }
  27.         if ((additionalMessages <= 0) && (additionalMinutes > 0)) {
  28.             System.out.printf("0 additional messages for 0.00 levas %n");
  29.             System.out.printf("%.0f additional minutes for %.2f levas %n", additionalMinutes, priceAdditionalMinutes);
  30.  
  31.             double priceAdditionalTaxes = 0.20 * (0 + priceAdditionalMinutes);
  32.             double totalBill = 12.00 + 1.20 * (0 + priceAdditionalMinutes);
  33.  
  34.             System.out.printf("%.2f additional taxes %n", priceAdditionalTaxes);
  35.             System.out.printf("%.2f total bill", totalBill);
  36.         }
  37.         if ((additionalMessages > 0) && (additionalMinutes <= 0)) {
  38.             System.out.printf("%d additional messages for %.2f levas %n", additionalMessages, priceAdditionalMessages);
  39.             System.out.printf("0 additional minutes for 0.00 levas %n", additionalMinutes, priceAdditionalMinutes);
  40.  
  41.             double priceAdditionalTaxes = 0.20 * (priceAdditionalMessages + 0);
  42.             double totalBill = 12.00 + 1.20 * (priceAdditionalMessages + 0);
  43.  
  44.             System.out.printf("%.2f additional taxes %n", priceAdditionalTaxes);
  45.             System.out.printf("%.2f total bill", totalBill);
  46.         }
  47.         if ((additionalMessages <= 0) && (additionalMinutes <= 0)) {
  48.             System.out.println("0 additional messages for 0.00 levas");
  49.             System.out.println("0 additional minutes for 0.00 levas");
  50.             System.out.println("0.00 additional taxes");
  51.             System.out.println("12.00 total bill");
  52.         }
  53.     }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement