z%U1<0j&asNkQgM>zXbRC&>=}aG)m;cPX4Vq$z2Zh
zhKM6^XVV%w?yMlPjLuE=I!xL+^
H_`CKWarTVI
literal 0
HcmV?d00001
diff --git a/src/DepositCalculator.java b/src/DepositCalculator.java
new file mode 100644
index 00000000..5d08e253
--- /dev/null
+++ b/src/DepositCalculator.java
@@ -0,0 +1,46 @@
+import java.util.Scanner;
+
+public class DepositCalculator {
+ double calculateComplexPercent(double amount, double yearRate, int depositPeriod) {
+ double pay = amount * Math.pow((1 + yearRate / 12), 12 * depositPeriod);
+ return squaring(pay, 2);
+ }
+
+ double calculateSimplePercent(double amount, double yearRate, int depositPeriod) {
+ return squaring(amount + amount * yearRate * depositPeriod, 2);
+ }
+
+ double squaring(double value, int places) {
+ double scale = Math.pow(10, places);
+ return Math.round(value * scale)/ scale;
+ }
+
+ void calculatePersents() {
+ int period;
+ int action;
+ Scanner scanner = new Scanner(System.in);
+
+ System.out.println("Введите сумму вклада в рублях:");
+ int amount = scanner.nextInt();
+
+ System.out.println("Введите срок вклада в годах:");
+ period = scanner.nextInt();
+
+ System.out.println("Выберите тип вклада, 1 - вклад с обычным процентом, 2 - вклад с капитализацией:");
+ action = scanner.nextInt();
+
+ double moneySum = 0;
+ if (action == 1) {
+ moneySum = calculateSimplePercent(amount, 0.06, period);
+ } else if (action == 2) {
+ moneySum = calculateComplexPercent(amount, 0.06, period);
+ }
+ System.out.println("Результат вклада: " + amount + " за " + period + " лет превратятся в " + moneySum);
+ }
+
+ public static void main(String[] args) {
+ new DepositCalculator().calculatePersents();
+ }
+
+
+}
diff --git a/src/calculate_deposit.java b/src/calculate_deposit.java
deleted file mode 100644
index 90164f11..00000000
--- a/src/calculate_deposit.java
+++ /dev/null
@@ -1,40 +0,0 @@
-import java.net.URI;import java.util.Scanner;import java.io.IOException;
-
-public class calculate_deposit
-{
-double Calculate_Complex_Percent_Function(double a, double y,int d ) {
- double pay = a * Math.pow((1 + y/ 12), 12 *d);
- return rnd(pay, 2);
- } double Calculate_Simple_Percent_Function(double doubleAmount,double double_year_rate, int deposit_period) {
- return rnd(doubleAmount+doubleAmount * double_year_rate *deposit_period, 2);
- } double rnd(double value
- ,int places) {
- double ScaLe= Math.pow
- (10, places);
- return Math.round(value*ScaLe)
- /ScaLe; }
-
- void do_important_job( )
- {
- int period, action ;
- Scanner abcdef = new Scanner(System.in); System.out.println("Введите сумму вклада в рублях:") ;
- int amount = abcdef.nextInt(); System.out.println("Введите срок вклада в годах:") ;
- period = abcdef.nextInt( );
- System.out.println ( "Выберите тип вклада, 1 - вклад с обычным процентом, 2 - вклад с капитализацией:");
- action = abcdef.nextInt();
- double outDoubleVar = 0;
- if (action ==1) outDoubleVar = Calculate_Simple_Percent_Function(amount, 0.06, period);
- else if (action == 2)
- {
- outDoubleVar = Calculate_Complex_Percent_Function(amount, 0.06, period); }
- System.out.println("Результат вклада: " + amount + " за " + period + " лет превратятся в " + outDoubleVar);
- }
-public static void main(String[] args)
- {
- new calculate_deposit().do_important_job();
-}
-
-
-
-
-}