Skip to content

style: изменить стиль кода #42

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

124 changes: 124 additions & 0 deletions .idea/uiDesigner.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
Привет ревьюеру Алексею Двоеглазову от Тимошенко Алексея!
# Code style. Правила красивого кода

## Форк репозитория

Чтобы сделать копию репозитория, нажмите кнопку Fork в правом верхнем углу страницы репозитория. После этого проект продублируется в ваш аккаунт на GitHub. Если у Вас нет аккаунта, его необходимо создать.
~Чтобы сделать копию репозитория, нажмите кнопку Fork в правом верхнем углу страницы репозитория. После этого проект продублируется в ваш аккаунт на GitHub. Если у Вас нет аккаунта, его необходимо создать.~

![fork button](https://raw.githubusercontent.com/PraktikumJava/public-resources/master/fork.png)

## Клонирование репозитория

На вашей странице GitHub откройте вкладку Repositories и выберите репозиторий, который вы форкнули на предыдущем этапе. Нажмите кнопку Code в правой части страницы:
**На вашей странице GitHub откройте вкладку Repositories и выберите репозиторий, который вы форкнули на предыдущем этапе. Нажмите кнопку Code в правой части страницы:**

![fork button](https://raw.githubusercontent.com/PraktikumJava/public-resources/master/clone.png)


Появится окно, из которого вы сможете скопировать адрес репозитория. Он понадобится для клонирования. Теперь откройте терминал и перейдите в папку, куда собираетесь сохранить репозиторий. Введите команду `git clone` и адрес репозитория:
*Появится окно, из которого вы сможете скопировать адрес репозитория. Он понадобится для клонирования. Теперь откройте терминал и перейдите в папку, куда собираетесь сохранить репозиторий. Введите команду `git clone` и адрес репозитория:*

```bash
git clone https://github.com/ТУТ_ИМЯ_ВАШЕГО_АККАНТА/code-style-and-effective-work-in-ide-code-style.git
Expand All @@ -26,3 +27,5 @@ git clone https://github.com/ТУТ_ИМЯ_ВАШЕГО_АККАНТА/code-styl
![fork button](https://raw.githubusercontent.com/PraktikumJava/public-resources/master/import.png)

В появившемся диалоговом окне открытия файлов выберите папку со склонированным репозиторием и нажмите кнопку Open. Обратите внимание, что открыть нужно весь каталог. После этого проект будет добавлен в IntelliJ IDEA.


11 changes: 11 additions & 0 deletions m1-t12-code-style.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
Binary file not shown.
42 changes: 42 additions & 0 deletions src/DepositCalculator.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import java.util.Scanner;

public class DepositCalculator {

double calculateComplexPercent(double startDeposit, double yearRate, int depositPeriod) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

public не требуется. Отлично!

double pay = startDeposit * Math.pow((1 + yearRate / 12), 12 * depositPeriod);
return roundFinalDeposit(pay, 2);
}

double calculateSimplePercent(double startDeposit, double yearRate, int depositPeriod) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Понятное название метода-отлично!

return roundFinalDeposit(startDeposit + startDeposit * yearRate * depositPeriod, 2);
}

double roundFinalDeposit(double finalDeposit, int DecimalPlaces) {
double scale = Math.pow(10, DecimalPlaces);
return Math.round(finalDeposit * scale) / scale;
}

void calculationDepositInterest() {
int depositPeriod;
int depositType;
Scanner scanner = new Scanner(System.in);
System.out.println("Введите сумму вклада в рублях:");
int startDeposit = scanner.nextInt();
System.out.println("Введите срок вклада в годах:");
depositPeriod = scanner.nextInt();
System.out.println("Выберите тип вклада, 1 - вклад с обычным процентом, 2 - вклад с капитализацией:");
depositType = scanner.nextInt();
double finalDeposit = 0;
if (depositType == 1) {
finalDeposit = calculateSimplePercent(startDeposit, 0.06, depositPeriod);
} else if (depositType == 2) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

else if без выравнивания , возможно можно лучше.

finalDeposit = calculateComplexPercent(startDeposit, 0.06, depositPeriod);
}
System.out.println("Результат вклада: " + startDeposit + " за " + depositPeriod + " лет превратятся в "

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Перенос метода на новую строку не требуется если не превышает размер 120 символов.

+ finalDeposit);
}

public static void main(String[] args) {
new DepositCalculator().calculationDepositInterest();
}
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Отлично выполненная работа!

40 changes: 0 additions & 40 deletions src/calculate_deposit.java

This file was deleted.