Advertisement
veronikaaa86

03. Deposit Calculator

Jun 7th, 2021
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 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 increase = deposit * (percent / 100);
  12. double monthlyIncrease = increase / 12;
  13.  
  14. double sum = deposit + (months * monthlyIncrease);
  15.  
  16. System.out.printf("%.2f", sum);
  17. }
  18. }
  19.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement