Advertisement
GabrielHr00

03. Deposit Calculator

May 14th, 2023
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.77 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class DepositCalculator {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.         double depositSum = Double.parseDouble(scanner.nextLine());
  7.         int depositDue = Integer.parseInt(scanner.nextLine());
  8.         double interestPercent = Double.parseDouble(scanner.nextLine());
  9.  
  10.         // сума = депозирана сума  + срок на депозита * ((депозирана сума * годишен лихвен процент ) / 12)
  11.  
  12.         double annualInterest = depositSum * interestPercent/100;
  13.         double monthlyInterest = annualInterest / 12;
  14.         double totalSum = depositSum + depositDue * monthlyInterest;
  15.  
  16.         System.out.println(totalSum);
  17.     }
  18. }
  19.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement