Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Main {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int months = Integer.parseInt(scanner.nextLine());
- int percent = Integer.parseInt(scanner.nextLine());
- double rent = Double.parseDouble(scanner.nextLine());
- int halfMonths = months / 2;
- double halfSum = rent * halfMonths;
- int secondHalf = months - halfMonths;
- double secondSum = (rent - (rent * (20 / 100.0))) * secondHalf;
- double totalSum = halfSum + secondSum;
- double broker = totalSum * (percent / 100.0);
- double totalSum2 = totalSum + broker;
- System.out.printf("Total: %.2f", totalSum2);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement