Skip to content

Conversation

@ping666
Copy link

@ping666 ping666 commented Oct 23, 2018

No description provided.

User of DK12 and others added 2 commits October 5, 2018 13:44
# Course of c#

Please write your name and surname here No newline at end of file
��������� ������� No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

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

Можо каким-то другим редактором поддреживающим кодировку?

laba2/Program.cs Outdated
}
static double Fan(double x)
{
double a = 0.1;
Copy link
Contributor

Choose a reason for hiding this comment

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

a и b следует также вынести в параметры функции

Copy link
Contributor

Choose a reason for hiding this comment

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

Так и не изменено :(

laba2/Program.cs Outdated
double a = 0.1;
double b = 0.5;
double y;
y = ((a + (Math.Tan(b * x)) * (Math.Tan(b * x))) / (b + (1 / (Math.Tan(a * x))) * (1 / (Math.Tan(a * x)))));
Copy link
Contributor

Choose a reason for hiding this comment

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

А зачем так разделять?

Copy link
Contributor

Choose a reason for hiding this comment

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

Объедините объявление и присвоение

Copy link
Contributor

@jskonst jskonst left a comment

Choose a reason for hiding this comment

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

Переместите код из Laba_2 в CourseApp - можно прямо в ProgramCS

Copy link
Contributor

Choose a reason for hiding this comment

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

Уберите все ненужные файлы

public void Test1()
{
City ivanovo = new City();
var res_country = ivanovo.Country;
Copy link
Contributor

Choose a reason for hiding this comment

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

А зачем вы временные переменные создаете? это как бы не обязательно

Copy link
Contributor

Choose a reason for hiding this comment

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

А вот стиль названия с _ в имени - не принят - поправьте

Assert.Equal(9000, res_population);
Assert.Equal("Ïèòåð", res_name);
}
[Fact]
Copy link
Contributor

Choose a reason for hiding this comment

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

Это почему тут осталось?

}
}

public City() { Name = "Иваново"; Country = "Россия"; population = 316; } // 1 конструктор
Copy link
Contributor

Choose a reason for hiding this comment

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

Переиспользуйте конструктор - данный донструктор без параметров должен вызвать основной констурктор, передав ему все параметры

{
population += pop;
}
public void Ueh()
Copy link
Contributor

Choose a reason for hiding this comment

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

Неее - вот первых - у какого города бы не выбрал метот - погибнет Иваново... Поэтому переделайет на общий случай - имя возьмите из свойств объекта


public class UnitTest1
{
public object Assert { get; private set; }
Copy link
Contributor

Choose a reason for hiding this comment

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

Вот корень всего зла, зачем добавили? я понимаю что Studio предложила и согласились сгенерировать...

@@ -0,0 +1,61 @@
namespace Test
{
using System;
Copy link
Contributor

Choose a reason for hiding this comment

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

это вроде бы как за пределы пространства имен, но если ругаться е будет, то ок

var rescountry = ivanovo.Country;
var respopulation = ivanovo.Population ;
var resname = ivanovo.Name;
Assert.Equal("Ðîññèÿ", rescountry);
Copy link
Contributor

Choose a reason for hiding this comment

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

можно сразу сравнивать с ivanovo.Country - зачем вам строчки выше?

[Fact]
public void Test4()
{
var res = Program.Formula(0.1, 0.5, 0.15);
Copy link
Contributor

Choose a reason for hiding this comment

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

Эти тесты должны быть в отдельном файле

Copy link
Contributor

Choose a reason for hiding this comment

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

Это упорно игнорируете :(

Console.WriteLine($"Название: {Name} Страна: {Country} Популяция: {population}");
}

public void Addpopulation(int pop)
Copy link
Contributor

Choose a reason for hiding this comment

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

правильее назвать AddPopulation - в camelCase - второе слово тоже сбольшой буквы

Copy link
Contributor

Choose a reason for hiding this comment

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

у нас все таки CamelCase - AddPopulation а не AddPopulation


public string Dead()
{
return $"Всё население города {Name} вымерло из-за аварии на АЭС.";
Copy link
Contributor

Choose a reason for hiding this comment

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

А если после вызова метода я спрошу про population?


public string Name { get; set; }
{
public class City
Copy link
Contributor

Choose a reason for hiding this comment

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

Воу воу - сразу нет - 1 файл 1 класс

Copy link
Contributor

@jskonst jskonst left a comment

Choose a reason for hiding this comment

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

Да и код не компилируется :( . А о чем мы договаривались - код в git'e как миимум компилируется :(

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.

2 participants