Advertisement
Guest User

Untitled

a guest
Dec 15th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Exam {
  4. public static void main(String[] args) {
  5. Scanner sc = new Scanner(System.in);
  6.  
  7. double period = Integer.parseInt(sc.nextLine());
  8. double commision = Integer.parseInt(sc.nextLine());
  9. double rentFee = Integer.parseInt(sc.nextLine());
  10.  
  11. var firstHalf = Math.floor(period / 2);
  12. var secondHalf = period - firstHalf;
  13. var rent = firstHalf * rentFee + secondHalf * (rentFee - rentFee * 0.2);
  14.  
  15. var totalSum = rent + rent * (commision / 100);
  16. System.out.printf("Total: %.2f", totalSum);
  17. }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement