Advertisement
myrdok123

03. Deposit Calculator

Jan 7th, 2024
903
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.78 KB | None | 0 0
  1. package W01FirstStepsInCoding.Exercises;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class P03DepositCalculator {
  6.  
  7.     public static void main(String[] args) {
  8.  
  9.         Scanner scanner = new Scanner(System.in);
  10.  
  11.  
  12.         //Прочитаме входните данни
  13.         double depositSum = Double.parseDouble(scanner.nextLine());
  14.         int months = Integer.parseInt(scanner.nextLine());
  15.         double interestRate = Double.parseDouble(scanner.nextLine());
  16.  
  17.         //Пресмятаме печалбата за месец
  18.         double profitPerMonth = (depositSum * ( interestRate / 100 )) / 12;
  19.  
  20.         //Пресмятаме общата сума
  21.         double totalSum = depositSum + profitPerMonth * months;
  22.  
  23.         System.out.println(totalSum);
  24.  
  25.  
  26.  
  27.  
  28.     }
  29. }
  30.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement