Not a member of Pastebin yet?
                        Sign Up,
                        it unlocks many cool features!                    
                - import java.util.Scanner;
- public class test {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int messages = Integer.parseInt(scanner.nextLine());
- int minutes = Integer.parseInt(scanner.nextLine());
- double messagesPrice = 0.06;
- double minutesPrice = 0.1;
- double messagesTotalPrice = 0;
- double minutesTotalPrice = 0;
- if (messages>20){
- messagesTotalPrice = (messages-20) * messagesPrice;
- }
- if (minutes>60){
- minutesTotalPrice = (minutes - 60) * 0.1;
- }
- double tax = (messagesTotalPrice + minutesTotalPrice) * 0.2;
- double totalPrice = messagesTotalPrice + minutesTotalPrice + tax + 12;
- System.out.printf("%d additional messages for %.2f levas%n", messages -20, messagesTotalPrice);
- System.out.printf("%d additional minutes for %.2f levas%n", minutes-60, minutesTotalPrice);
- System.out.printf("%.2f additional taxes%n", tax);
- System.out.printf("%.2f total bill", totalPrice);
- }
- }
Advertisement
 
                    Add Comment                
                
                        Please, Sign In to add comment                    
                 
                    