Skip to content

gornovanton1992#19

Open
gornovanton1992 wants to merge 11 commits intojavaGuruBY:masterfrom
gornovanton1992:master
Open

gornovanton1992#19
gornovanton1992 wants to merge 11 commits intojavaGuruBY:masterfrom
gornovanton1992:master

Conversation

@gornovanton1992
Copy link
Collaborator

No description provided.

public double calculateArea(){
return Math.PI*Math.pow(this.radius,2);
}
public void vvodRadius(){
Copy link
Collaborator

Choose a reason for hiding this comment

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

вместо vvodRadius принятописать английскими словами, потому что код может попасть и к англоязычным разработчикам или тем, кто назвал бы иначе. Для универсальности лучше использовать английские слова в названиях.
Вместо vvodRadius - inputRadius

public static void main(String[] args) {
Circle oneCircle = new Circle();
oneCircle.vvodRadius();
double ploschad = oneCircle.calculateArea();
Copy link
Collaborator

Choose a reason for hiding this comment

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

заменить русскоязычное на английское слово
ploschad -> area

}

public void printInfo() {
System.out.println();
Copy link
Collaborator

Choose a reason for hiding this comment

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

попробовать здесь использовать класс StringBuffer или StringBuilder c методом .append()
Меньше конкатенаций (сложения строк через +) - быстрее и легче в оперативке программа

System.out.println("Hi! My name is " + this.name + ", I'm " + this.age + " years old");
}

public void vvodInfo() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

заменить русскоязычное на английское слово
vvodInfo -> inputInfo

Comment on lines +5 to +35

Scanner in = new Scanner(System.in); // вызов функции для ввода числа из консоли в программу//
System.out.println("введите первое слогаемое");
int a = in.nextInt(); // ввод числа в программу//
System.out.println("введите второе слогаемое");
int b = in.nextInt();
System.out.println("сумма чисел равна " + (a + b));
System.out.println();

Scanner in1 = new Scanner(System.in);
System.out.println("введите уменьшаемое");
a = in1.nextInt();
System.out.println("введите вычетаемое");
b = in1.nextInt();
System.out.println("разность чисел равна " + (a - b));
System.out.println();

Scanner in2 = new Scanner(System.in);
System.out.println("введите первый множитель ");
a = in2.nextInt();
System.out.println("введите второй множитель");
b = in2.nextInt();
System.out.println("произведение равно " + (a * b));
System.out.println();

Scanner in3 = new Scanner(System.in);
System.out.println("введите делимое ");
float c = in3.nextInt();
System.out.println("введите делитель");
float d = in3.nextInt();
System.out.println("частное равно " + (c / d));
Copy link
Collaborator

Choose a reason for hiding this comment

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

каждый блок по одной операции можно вывести в private методы в этом же классе, чтобы были компактнее методы и легче сам main. Если что - идея из книги "Чистый код". Компактные методы легче читать и поддерживать

int num1 = ran.nextInt();
int num2 = ran.nextInt();
int num3 = ran.nextInt();
System.out.println("сгенерированы 3 случайных числа " + num1 +", " + num2 + " ," + num3 );
Copy link
Collaborator

Choose a reason for hiding this comment

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

попробуй StringBuilder вместо + для строк и параметров

Copy link
Collaborator

@shpaser2 shpaser2 left a comment

Choose a reason for hiding this comment

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

посмотри комментарии к строкам у файлов. Дал дельные советы исходя из своего опыта

Copy link
Collaborator

@KaydunovDenis KaydunovDenis left a comment

Choose a reason for hiding this comment

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

Необходимо внести исправления.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants