Advertisement
veronikaaa86

03. Deposit Calculator

Jan 9th, 2022
318
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class P03DepositCalculator {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6.  
  7. double deposit = Double.parseDouble(scanner.nextLine());
  8. int months = Integer.parseInt(scanner.nextLine());
  9. double percent = Double.parseDouble(scanner.nextLine());
  10.  
  11. // double result = deposit + months *
  12. // ((deposit * (percent / 100)) / 12);
  13.  
  14. double increase = deposit * (percent / 100);
  15. double monthlyIncrease = increase / 12;
  16.  
  17. double result = deposit + months * monthlyIncrease;
  18.  
  19. System.out.println(result);
  20. }
  21. }
  22.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement