Advertisement
GabrielHr00

03. Deposit Calculator

Jan 5th, 2025
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.72 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.  
  7.         double depositSum = Double.parseDouble(scanner.nextLine());
  8.         int depositDue = Integer.parseInt(scanner.nextLine());
  9.         double annualPercent = Double.parseDouble(scanner.nextLine());
  10.  
  11.         //сума = депозирана сума  + срок на депозита *
  12.         // ((депозирана сума * годишен лихвен процент ) / 12)
  13.  
  14.         double monthlyInterest = (depositSum * (annualPercent/100)) / 12;
  15.         double sum = depositSum + depositDue * monthlyInterest;
  16.  
  17.         System.out.println(sum);
  18.     }
  19. }
  20.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement