Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner userInput = new Scanner(System.in);
- int textMessages = userInput.nextInt();
- double minutes = userInput.nextDouble();
- int additionalMessages = textMessages - 20;
- double additionalMinutes = minutes - 60;
- double priceAdditionalMessages = additionalMessages * 0.06;
- double priceAdditionalMinutes = additionalMinutes * 0.10;
- if ((additionalMessages > 0) && (additionalMinutes) > 0) {
- System.out.printf("%d additional messages for %.2f levas %n", additionalMessages, priceAdditionalMessages);
- System.out.printf("%.0f additional minutes for %.2f levas %n", additionalMinutes, priceAdditionalMinutes);
- double priceAdditionalTaxes = 0.20 * (priceAdditionalMessages + priceAdditionalMinutes);
- double totalBill = 12.00 + 1.20 * (priceAdditionalMessages + priceAdditionalMinutes);
- System.out.printf("%.2f additional taxes %n", priceAdditionalTaxes);
- System.out.printf("%.2f total bill", totalBill);
- }
- if ((additionalMessages <= 0) && (additionalMinutes > 0)) {
- System.out.printf("0 additional messages for 0.00 levas %n");
- System.out.printf("%.0f additional minutes for %.2f levas %n", additionalMinutes, priceAdditionalMinutes);
- double priceAdditionalTaxes = 0.20 * (0 + priceAdditionalMinutes);
- double totalBill = 12.00 + 1.20 * (0 + priceAdditionalMinutes);
- System.out.printf("%.2f additional taxes %n", priceAdditionalTaxes);
- System.out.printf("%.2f total bill", totalBill);
- }
- if ((additionalMessages > 0) && (additionalMinutes <= 0)) {
- System.out.printf("%d additional messages for %.2f levas %n", additionalMessages, priceAdditionalMessages);
- System.out.printf("0 additional minutes for 0.00 levas %n", additionalMinutes, priceAdditionalMinutes);
- double priceAdditionalTaxes = 0.20 * (priceAdditionalMessages + 0);
- double totalBill = 12.00 + 1.20 * (priceAdditionalMessages + 0);
- System.out.printf("%.2f additional taxes %n", priceAdditionalTaxes);
- System.out.printf("%.2f total bill", totalBill);
- }
- if ((additionalMessages <= 0) && (additionalMinutes <= 0)) {
- System.out.println("0 additional messages for 0.00 levas");
- System.out.println("0 additional minutes for 0.00 levas");
- System.out.println("0.00 additional taxes");
- System.out.println("12.00 total bill");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement