Advertisement
veronikaaa86

03. Deposit Calculator

Oct 31st, 2021
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. package firstSteps;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class P03DepositCalculator {
  6. public static void main(String[] args) {
  7. Scanner scanner = new Scanner(System.in);
  8.  
  9. double deposit = Double.parseDouble(scanner.nextLine());
  10. int months = Integer.parseInt(scanner.nextLine());
  11. double percent = Double.parseDouble(scanner.nextLine());
  12.  
  13. //сума = депозирана сума + срок на депозита * ((депозирана сума * годишен лихвен процент ) / 12)
  14.  
  15. double increase = deposit * (percent / 100);
  16. double monthlyIncrease = increase / 12;
  17.  
  18. double sum = deposit + (months * monthlyIncrease);
  19.  
  20. System.out.println(sum);
  21. }
  22. }
  23.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement