From df55d1a3fcae2d64ed1090c78403269677482211 Mon Sep 17 00:00:00 2001 From: Maxim Date: Mon, 9 Dec 2019 09:02:23 +0300 Subject: [PATCH 01/10] Added superobject , second child , 2 more tests --- CourseApp.Tests/DishTest.cs | 33 ++++++++++++++ CourseApp/Dish.cs | 70 +---------------------------- CourseApp/Drink.cs | 41 +++++++++++++++++ CourseApp/Food.cs | 87 +++++++++++++++++++++++++++++++++++++ 4 files changed, 162 insertions(+), 69 deletions(-) create mode 100644 CourseApp/Drink.cs create mode 100644 CourseApp/Food.cs diff --git a/CourseApp.Tests/DishTest.cs b/CourseApp.Tests/DishTest.cs index c029a03..45b1d04 100644 --- a/CourseApp.Tests/DishTest.cs +++ b/CourseApp.Tests/DishTest.cs @@ -111,5 +111,38 @@ public void TestStats() bool bl = item.Cook(); Assert.True(bl); } + + [Fact] + public void TestDrinkVolume() + { + try + { + var item = new Drink(); + item.Volume = 15; + Assert.Equal(15, item.Volume); + var item2 = new Drink(); + item2.Volume = -5; + } + catch (ArgumentOutOfRangeException outOfRange) + { + Console.WriteLine(outOfRange.Message); + Assert.True(true); + } + } + + [Fact] + public void TestDrinkIncorrectVolume() + { + try + { + var item = new Drink(); + item.Volume = -5; + } + catch (ArgumentOutOfRangeException outOfRange) + { + Console.WriteLine(outOfRange.Message); + Assert.True(true); + } + } } } \ No newline at end of file diff --git a/CourseApp/Dish.cs b/CourseApp/Dish.cs index baf2918..29db4ff 100644 --- a/CourseApp/Dish.cs +++ b/CourseApp/Dish.cs @@ -2,12 +2,8 @@ namespace CourseApp { - public class Dish + public class Dish : Food { - private int rating; - private int weight; - private int cal; - public Dish() : this(0, "Untitled", true) { @@ -20,70 +16,6 @@ public Dish(int rating, string name, bool isReady) IsReady = isReady; } - public string Name { get; set; } - - public bool IsReady { get; set; } - - public int Rating - { - get - { - return this.rating; - } - - set - { - if (value >= 0 && value < 100) - { - this.rating = value; - } - else - { - throw new ArgumentOutOfRangeException("value", "Rating should be > 0 and < than 100"); - } - } - } - - public int Weight - { - get - { - return this.weight; - } - - set - { - if (value >= 0) - { - this.weight = value; - } - else - { - throw new ArgumentOutOfRangeException("value", "Weight should be > 0"); - } - } - } - - public int Cal - { - get - { - return this.cal; - } - - set - { - if (value >= 0) - { - this.cal = value; - } - else - { - throw new ArgumentOutOfRangeException("value", "Calories should be > 0"); - } - } - } - public bool Cook() { this.IsReady = true; diff --git a/CourseApp/Drink.cs b/CourseApp/Drink.cs new file mode 100644 index 0000000..e2d5555 --- /dev/null +++ b/CourseApp/Drink.cs @@ -0,0 +1,41 @@ +using System; + +namespace CourseApp +{ + public class Drink : Food + { + private double volume; + + public Drink() + : this(0, "Untitled", true) + { + } + + public Drink(int rating, string name, bool isReady) + { + Name = name; + Rating = rating; + IsReady = isReady; + } + + public double Volume + { + get + { + return this.volume; + } + + set + { + if (value >= 0) + { + this.volume = value; + } + else + { + throw new ArgumentOutOfRangeException("value", "Weight should be > 0"); + } + } + } + } +} \ No newline at end of file diff --git a/CourseApp/Food.cs b/CourseApp/Food.cs new file mode 100644 index 0000000..909fd90 --- /dev/null +++ b/CourseApp/Food.cs @@ -0,0 +1,87 @@ +using System; + +namespace CourseApp +{ + public class Food + { + private int rating; + private double weight; + private double cal; + + public Food() + : this(0, "Untitled", true) + { + } + + public Food(int rating, string name, bool isReady) + { + Name = name; + Rating = rating; + IsReady = isReady; + } + + public string Name { get; set; } + + public bool IsReady { get; set; } + + public int Rating + { + get + { + return this.rating; + } + + set + { + if (value >= 0 && value < 100) + { + this.rating = value; + } + else + { + throw new ArgumentOutOfRangeException("value", "Rating should be > 0 and < than 100"); + } + } + } + + public double Weight + { + get + { + return this.weight; + } + + set + { + if (value >= 0) + { + this.weight = value; + } + else + { + throw new ArgumentOutOfRangeException("value", "Weight should be > 0"); + } + } + } + + public double Cal + { + get + { + return this.cal; + } + + set + { + if (value >= 0) + { + this.cal = value; + } + else + { + throw new ArgumentOutOfRangeException("value", "Calories should be > 0"); + } + } + } + } +} \ No newline at end of file From 59da0dad8a40ecb84d51d4f5157e9cccb499c89c Mon Sep 17 00:00:00 2001 From: a309 Date: Mon, 16 Dec 2019 09:43:21 +0400 Subject: [PATCH 02/10] ageCalc --- AgeCalc/AgeCalc.sln | 25 ++++++ AgeCalc/AgeCalc/AgeCalc.csproj | 8 ++ AgeCalc/AgeCalc/Program.cs | 149 +++++++++++++++++++++++++++++++++ CourseApp.Tests/AgeTest.cs | 23 +++++ CourseApp.Tests/DishTest.cs | 4 + CourseApp/AgeCalc.cs | 41 +++++++++ CourseApp/Food.cs | 1 - CourseApp/Program.cs | 1 + 8 files changed, 251 insertions(+), 1 deletion(-) create mode 100644 AgeCalc/AgeCalc.sln create mode 100644 AgeCalc/AgeCalc/AgeCalc.csproj create mode 100644 AgeCalc/AgeCalc/Program.cs create mode 100644 CourseApp.Tests/AgeTest.cs create mode 100644 CourseApp/AgeCalc.cs diff --git a/AgeCalc/AgeCalc.sln b/AgeCalc/AgeCalc.sln new file mode 100644 index 0000000..b6cfad0 --- /dev/null +++ b/AgeCalc/AgeCalc.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.27428.2002 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AgeCalc", "AgeCalc\AgeCalc.csproj", "{D55EA859-5E8F-487A-A3DD-A32EED0F78DF}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D55EA859-5E8F-487A-A3DD-A32EED0F78DF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D55EA859-5E8F-487A-A3DD-A32EED0F78DF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D55EA859-5E8F-487A-A3DD-A32EED0F78DF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D55EA859-5E8F-487A-A3DD-A32EED0F78DF}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {D469B0EB-F688-481C-BCC1-85104A9B185E} + EndGlobalSection +EndGlobal diff --git a/AgeCalc/AgeCalc/AgeCalc.csproj b/AgeCalc/AgeCalc/AgeCalc.csproj new file mode 100644 index 0000000..ce1697a --- /dev/null +++ b/AgeCalc/AgeCalc/AgeCalc.csproj @@ -0,0 +1,8 @@ + + + + Exe + netcoreapp2.0 + + + diff --git a/AgeCalc/AgeCalc/Program.cs b/AgeCalc/AgeCalc/Program.cs new file mode 100644 index 0000000..d029f98 --- /dev/null +++ b/AgeCalc/AgeCalc/Program.cs @@ -0,0 +1,149 @@ +using System; + +namespace AgeCalc +{ + class Program + { + + public static int AgeCalc(DateTime date) + { + + DateTime curDate = DateTime.Now; + + int age = curDate.Year - date.Year; + + if (curDate.Month < date.Month || + (curDate.Month == date.Month && curDate.Day < date.Day)) age--; + + return age; + } + + static void Main(string[] args) + { + Console.WriteLine("input year"); + int year = Convert.ToInt32(Console.ReadLine()); + if (year < 0) + { + throw new ArgumentOutOfRangeException("year"); + } + Console.WriteLine("input month"); + int month = Convert.ToInt32(Console.ReadLine()); + if (month < 0) + { + throw new ArgumentOutOfRangeException("year"); + } + Console.WriteLine("input day"); + int day = Convert.ToInt32(Console.ReadLine()); + if (day < 0) + { + throw new ArgumentOutOfRangeException("year"); + } + + + + DateTime inputDate = new DateTime(year, month, day); + if (inputDate == DateTime.Now) { + throw new ArgumentException("inputDate"); + } + + + int output = AgeCalc(inputDate); + + Console.WriteLine(output); + + Console.ReadLine(); + } + } +} + + + + +namespace AgeCalc.Tests +{ + public class DemoTest + { + [Theory] + [InlineData(7.2, 3.8, 1, 0)] + [InlineData(12.2, 4.5, 1, 0)] + [InlineData(20.2, 2.7, 1, 0)] + + public void TestForFunctionValues(double a, double b, double x, double exp) + { + var res = Program.MyFunction(a, b, x); + Assert.Equal(res, exp); + } + + [Fact] + public void TestFunctionZeroVal() + { + var res = Program.MyFunction(0, 0, 0); + Assert.Equal(0, res, 3); + } + + [Theory] + [InlineData(7.2, 4.2, 1.81, 5.31, 0.7)] + [InlineData(3.2, 3.2, 1.5, 6.1, 0.5)] + [InlineData(4.1, 1.1, 0.3, 6.5, 1.0)] + + public void TestTaskAElements(double a, double b, double xn, double xk, double dx) + { + try + { + var res = Program.TaskA(a, b, xn, xk, dx); + double massElemExpected = (xk - xn) / dx; + Assert.Equal(expected: massElemExpected, actual: res.Count); + } + catch (IndexOutOfRangeException) + { + Console.WriteLine("Out Of Bounds"); + Assert.True(true); + } + } + + [Theory] + [InlineData(7.2, 4.2, 1.81, 5.31, 0.7)] + [InlineData(3.2, 3.2, 1.5, 6.1, 0.5)] + + public void TestATaskAllMoreThenZero(double a, double b, double xn, double xk, double dx) + { + try + { + var res = Program.TaskA(a, b, xn, xk, dx); + + double massElemExpected = (xk - xn) / dx; + + Assert.Equal(expected: massElemExpected, actual: res.Count); + } + catch (IndexOutOfRangeException) + { + Console.WriteLine("Out Of Bounds"); + Assert.True(true); + } + catch (ArgumentOutOfRangeException) + { + Console.WriteLine("Argument Out Of Range"); + Assert.True(true); + } + } + + [Fact] + public void TestATaskTooLargeSteps() + { + var res = Program.TaskA(7.2, 4.2, 1.81, 5.31, 5); + int count = res.Count; + Assert.Equal(1, count); + } + + [Theory] + [InlineData(4.1, 2.7)] + [InlineData(5.2, 3.5)] + [InlineData(6.3, 1.3)] + public void TestTaskB(double a, double b) + { + double[] e = new double[0]; + var res = Program.TaskB(a, b, e); + Assert.Equal(res, new double[0]); + } + } +} diff --git a/CourseApp.Tests/AgeTest.cs b/CourseApp.Tests/AgeTest.cs new file mode 100644 index 0000000..ae39db3 --- /dev/null +++ b/CourseApp.Tests/AgeTest.cs @@ -0,0 +1,23 @@ +using System; +using Xunit; + +namespace CourseApp.Tests +{ + public class AgeTest + { + [Fact] + public void TestDrinkIncorrectVolume() + { + try + { + var item = new Drink(); + item.Volume = -5; + } + catch (ArgumentOutOfRangeException outOfRange) + { + Console.WriteLine(outOfRange.Message); + Assert.True(true); + } + } + } +} \ No newline at end of file diff --git a/CourseApp.Tests/DishTest.cs b/CourseApp.Tests/DishTest.cs index 45b1d04..a34e102 100644 --- a/CourseApp.Tests/DishTest.cs +++ b/CourseApp.Tests/DishTest.cs @@ -145,4 +145,8 @@ public void TestDrinkIncorrectVolume() } } } +() + { + + } } \ No newline at end of file diff --git a/CourseApp/AgeCalc.cs b/CourseApp/AgeCalc.cs new file mode 100644 index 0000000..ac40137 --- /dev/null +++ b/CourseApp/AgeCalc.cs @@ -0,0 +1,41 @@ +using System; + +namespace CourseApp +{ + public class AgeCalc + { + public static DateTime AgeCalcFunc(DateTime date) + { + DateTime curDate = DateTime.Now; + DateTime datemin = new DateTime(2, 2, 1); + DateTime age = new DateTime(curDate.Ticks - date.Ticks - datemin.Ticks); + + // age = new DateTime(age.Year - , age.Month - 1, age.Day); + return age; + } + + internal static void AgeMain() + { + Console.WriteLine("input year"); + int year = Convert.ToInt32(Console.ReadLine()); + + Console.WriteLine("input month"); + int month = Convert.ToInt32(Console.ReadLine()); + + Console.WriteLine("input day"); + int day = Convert.ToInt32(Console.ReadLine()); + + DateTime inputDate = new DateTime(year, month, day); + if (inputDate == DateTime.Now) + { + throw new ArgumentException("inputDate"); + } + + DateTime output = AgeCalcFunc(inputDate); + + Console.WriteLine(output); + + Console.ReadLine(); + } + } +} \ No newline at end of file diff --git a/CourseApp/Food.cs b/CourseApp/Food.cs index 909fd90..9471596 100644 --- a/CourseApp/Food.cs +++ b/CourseApp/Food.cs @@ -16,7 +16,6 @@ public Food() public Food(int rating, string name, bool isReady) { Name = name; - Rating = rating; IsReady = isReady; } diff --git a/CourseApp/Program.cs b/CourseApp/Program.cs index d275536..5824efb 100644 --- a/CourseApp/Program.cs +++ b/CourseApp/Program.cs @@ -98,6 +98,7 @@ public static void Main(string[] args) Console.WriteLine($"y = {item}"); } + AgeCalc.AgeMain(); Console.ReadLine(); } } From c7d96029a0b6ef84cb23dd8ee6a2272e68681782 Mon Sep 17 00:00:00 2001 From: a309 Date: Sat, 21 Dec 2019 13:52:27 +0400 Subject: [PATCH 03/10] added ageCalc tests --- CourseApp.Tests/AgeTest.cs | 22 +++++++++++++++++----- CourseApp.Tests/DishTest.cs | 4 ---- CourseApp/AgeCalc.cs | 13 +++++++++++-- 3 files changed, 28 insertions(+), 11 deletions(-) diff --git a/CourseApp.Tests/AgeTest.cs b/CourseApp.Tests/AgeTest.cs index ae39db3..ab58926 100644 --- a/CourseApp.Tests/AgeTest.cs +++ b/CourseApp.Tests/AgeTest.cs @@ -5,19 +5,31 @@ namespace CourseApp.Tests { public class AgeTest { - [Fact] - public void TestDrinkIncorrectVolume() + [Theory] + [InlineData(2000, 11, 26)] + [InlineData(7000, 4, 5)] + [InlineData(2019, 12, 21)] + + public void TestForAgeCalcValues(int year, int month, int day) { try { - var item = new Drink(); - item.Volume = -5; + DateTime inputDate = new DateTime(year, month, day); + DateTime result = AgeCalc.AgeCalcFunc(inputDate); + DateTime datemin = new DateTime(2, 2, 1); + DateTime expect = new DateTime(DateTime.Now.Ticks - inputDate.Ticks - datemin.Ticks); + Assert.Equal(expected: expect, actual: result); } - catch (ArgumentOutOfRangeException outOfRange) + catch (IndexOutOfRangeException outOfRange) { Console.WriteLine(outOfRange.Message); Assert.True(true); } + catch (ArgumentException argEx) + { + Console.WriteLine(argEx.Message); + Assert.True(true); + } } } } \ No newline at end of file diff --git a/CourseApp.Tests/DishTest.cs b/CourseApp.Tests/DishTest.cs index a34e102..45b1d04 100644 --- a/CourseApp.Tests/DishTest.cs +++ b/CourseApp.Tests/DishTest.cs @@ -145,8 +145,4 @@ public void TestDrinkIncorrectVolume() } } } -() - { - - } } \ No newline at end of file diff --git a/CourseApp/AgeCalc.cs b/CourseApp/AgeCalc.cs index ac40137..a6577d2 100644 --- a/CourseApp/AgeCalc.cs +++ b/CourseApp/AgeCalc.cs @@ -7,10 +7,19 @@ public class AgeCalc public static DateTime AgeCalcFunc(DateTime date) { DateTime curDate = DateTime.Now; + + if (date > curDate) + { + throw new IndexOutOfRangeException(); + } + + if (date == curDate) + { + throw new ArgumentException(); + } + DateTime datemin = new DateTime(2, 2, 1); DateTime age = new DateTime(curDate.Ticks - date.Ticks - datemin.Ticks); - - // age = new DateTime(age.Year - , age.Month - 1, age.Day); return age; } From a67c13a134b1d0c69c5ca7721a0226663daf4021 Mon Sep 17 00:00:00 2001 From: a309 Date: Sat, 21 Dec 2019 14:16:09 +0400 Subject: [PATCH 04/10] added input method --- CourseApp/AgeCalc.cs | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/CourseApp/AgeCalc.cs b/CourseApp/AgeCalc.cs index a6577d2..c644cff 100644 --- a/CourseApp/AgeCalc.cs +++ b/CourseApp/AgeCalc.cs @@ -4,6 +4,21 @@ namespace CourseApp { public class AgeCalc { + public static DateTime AgeInput() + { + Console.WriteLine("input year"); + int year = Convert.ToInt32(Console.ReadLine()); + + Console.WriteLine("input month"); + int month = Convert.ToInt32(Console.ReadLine()); + + Console.WriteLine("input day"); + int day = Convert.ToInt32(Console.ReadLine()); + + DateTime inputDate = new DateTime(year, month, day); + return inputDate; + } + public static DateTime AgeCalcFunc(DateTime date) { DateTime curDate = DateTime.Now; @@ -25,22 +40,7 @@ public static DateTime AgeCalcFunc(DateTime date) internal static void AgeMain() { - Console.WriteLine("input year"); - int year = Convert.ToInt32(Console.ReadLine()); - - Console.WriteLine("input month"); - int month = Convert.ToInt32(Console.ReadLine()); - - Console.WriteLine("input day"); - int day = Convert.ToInt32(Console.ReadLine()); - - DateTime inputDate = new DateTime(year, month, day); - if (inputDate == DateTime.Now) - { - throw new ArgumentException("inputDate"); - } - - DateTime output = AgeCalcFunc(inputDate); + DateTime output = AgeCalcFunc(AgeInput()); Console.WriteLine(output); From 040b90316b0f56d7f72ec5e9d47648342d7b54ae Mon Sep 17 00:00:00 2001 From: a309 Date: Sat, 21 Dec 2019 14:36:34 +0400 Subject: [PATCH 05/10] added test fix --- CourseApp.Tests/AgeTest.cs | 3 ++- CourseApp/AgeCalc.cs | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CourseApp.Tests/AgeTest.cs b/CourseApp.Tests/AgeTest.cs index ab58926..578f58a 100644 --- a/CourseApp.Tests/AgeTest.cs +++ b/CourseApp.Tests/AgeTest.cs @@ -17,7 +17,8 @@ public void TestForAgeCalcValues(int year, int month, int day) DateTime inputDate = new DateTime(year, month, day); DateTime result = AgeCalc.AgeCalcFunc(inputDate); DateTime datemin = new DateTime(2, 2, 1); - DateTime expect = new DateTime(DateTime.Now.Ticks - inputDate.Ticks - datemin.Ticks); + DateTime curDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day); + DateTime expect = new DateTime(curDate.Ticks - inputDate.Ticks - datemin.Ticks); Assert.Equal(expected: expect, actual: result); } catch (IndexOutOfRangeException outOfRange) diff --git a/CourseApp/AgeCalc.cs b/CourseApp/AgeCalc.cs index c644cff..2446220 100644 --- a/CourseApp/AgeCalc.cs +++ b/CourseApp/AgeCalc.cs @@ -21,7 +21,7 @@ public static DateTime AgeInput() public static DateTime AgeCalcFunc(DateTime date) { - DateTime curDate = DateTime.Now; + DateTime curDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day); if (date > curDate) { From 3cf32c970b79e6728e80fa03f6ceae4f1457b54a Mon Sep 17 00:00:00 2001 From: a309 Date: Sat, 21 Dec 2019 14:49:04 +0400 Subject: [PATCH 06/10] removed trashfile --- AgeCalc/AgeCalc.sln | 25 ------ AgeCalc/AgeCalc/AgeCalc.csproj | 8 -- AgeCalc/AgeCalc/Program.cs | 149 --------------------------------- 3 files changed, 182 deletions(-) delete mode 100644 AgeCalc/AgeCalc.sln delete mode 100644 AgeCalc/AgeCalc/AgeCalc.csproj delete mode 100644 AgeCalc/AgeCalc/Program.cs diff --git a/AgeCalc/AgeCalc.sln b/AgeCalc/AgeCalc.sln deleted file mode 100644 index b6cfad0..0000000 --- a/AgeCalc/AgeCalc.sln +++ /dev/null @@ -1,25 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.27428.2002 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AgeCalc", "AgeCalc\AgeCalc.csproj", "{D55EA859-5E8F-487A-A3DD-A32EED0F78DF}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {D55EA859-5E8F-487A-A3DD-A32EED0F78DF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D55EA859-5E8F-487A-A3DD-A32EED0F78DF}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D55EA859-5E8F-487A-A3DD-A32EED0F78DF}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D55EA859-5E8F-487A-A3DD-A32EED0F78DF}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {D469B0EB-F688-481C-BCC1-85104A9B185E} - EndGlobalSection -EndGlobal diff --git a/AgeCalc/AgeCalc/AgeCalc.csproj b/AgeCalc/AgeCalc/AgeCalc.csproj deleted file mode 100644 index ce1697a..0000000 --- a/AgeCalc/AgeCalc/AgeCalc.csproj +++ /dev/null @@ -1,8 +0,0 @@ - - - - Exe - netcoreapp2.0 - - - diff --git a/AgeCalc/AgeCalc/Program.cs b/AgeCalc/AgeCalc/Program.cs deleted file mode 100644 index d029f98..0000000 --- a/AgeCalc/AgeCalc/Program.cs +++ /dev/null @@ -1,149 +0,0 @@ -using System; - -namespace AgeCalc -{ - class Program - { - - public static int AgeCalc(DateTime date) - { - - DateTime curDate = DateTime.Now; - - int age = curDate.Year - date.Year; - - if (curDate.Month < date.Month || - (curDate.Month == date.Month && curDate.Day < date.Day)) age--; - - return age; - } - - static void Main(string[] args) - { - Console.WriteLine("input year"); - int year = Convert.ToInt32(Console.ReadLine()); - if (year < 0) - { - throw new ArgumentOutOfRangeException("year"); - } - Console.WriteLine("input month"); - int month = Convert.ToInt32(Console.ReadLine()); - if (month < 0) - { - throw new ArgumentOutOfRangeException("year"); - } - Console.WriteLine("input day"); - int day = Convert.ToInt32(Console.ReadLine()); - if (day < 0) - { - throw new ArgumentOutOfRangeException("year"); - } - - - - DateTime inputDate = new DateTime(year, month, day); - if (inputDate == DateTime.Now) { - throw new ArgumentException("inputDate"); - } - - - int output = AgeCalc(inputDate); - - Console.WriteLine(output); - - Console.ReadLine(); - } - } -} - - - - -namespace AgeCalc.Tests -{ - public class DemoTest - { - [Theory] - [InlineData(7.2, 3.8, 1, 0)] - [InlineData(12.2, 4.5, 1, 0)] - [InlineData(20.2, 2.7, 1, 0)] - - public void TestForFunctionValues(double a, double b, double x, double exp) - { - var res = Program.MyFunction(a, b, x); - Assert.Equal(res, exp); - } - - [Fact] - public void TestFunctionZeroVal() - { - var res = Program.MyFunction(0, 0, 0); - Assert.Equal(0, res, 3); - } - - [Theory] - [InlineData(7.2, 4.2, 1.81, 5.31, 0.7)] - [InlineData(3.2, 3.2, 1.5, 6.1, 0.5)] - [InlineData(4.1, 1.1, 0.3, 6.5, 1.0)] - - public void TestTaskAElements(double a, double b, double xn, double xk, double dx) - { - try - { - var res = Program.TaskA(a, b, xn, xk, dx); - double massElemExpected = (xk - xn) / dx; - Assert.Equal(expected: massElemExpected, actual: res.Count); - } - catch (IndexOutOfRangeException) - { - Console.WriteLine("Out Of Bounds"); - Assert.True(true); - } - } - - [Theory] - [InlineData(7.2, 4.2, 1.81, 5.31, 0.7)] - [InlineData(3.2, 3.2, 1.5, 6.1, 0.5)] - - public void TestATaskAllMoreThenZero(double a, double b, double xn, double xk, double dx) - { - try - { - var res = Program.TaskA(a, b, xn, xk, dx); - - double massElemExpected = (xk - xn) / dx; - - Assert.Equal(expected: massElemExpected, actual: res.Count); - } - catch (IndexOutOfRangeException) - { - Console.WriteLine("Out Of Bounds"); - Assert.True(true); - } - catch (ArgumentOutOfRangeException) - { - Console.WriteLine("Argument Out Of Range"); - Assert.True(true); - } - } - - [Fact] - public void TestATaskTooLargeSteps() - { - var res = Program.TaskA(7.2, 4.2, 1.81, 5.31, 5); - int count = res.Count; - Assert.Equal(1, count); - } - - [Theory] - [InlineData(4.1, 2.7)] - [InlineData(5.2, 3.5)] - [InlineData(6.3, 1.3)] - public void TestTaskB(double a, double b) - { - double[] e = new double[0]; - var res = Program.TaskB(a, b, e); - Assert.Equal(res, new double[0]); - } - } -} From d53e73bf377f5470c284961df0fe17e49bb13bef Mon Sep 17 00:00:00 2001 From: a309 Date: Sat, 21 Dec 2019 14:53:28 +0400 Subject: [PATCH 07/10] hardcoded tests --- CourseApp.Tests/AgeTest.cs | 4 ++-- CourseApp/AgeCalc.cs | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/CourseApp.Tests/AgeTest.cs b/CourseApp.Tests/AgeTest.cs index 578f58a..a8a536f 100644 --- a/CourseApp.Tests/AgeTest.cs +++ b/CourseApp.Tests/AgeTest.cs @@ -14,10 +14,10 @@ public void TestForAgeCalcValues(int year, int month, int day) { try { + DateTime curDate = new DateTime(2019, 12, 11); DateTime inputDate = new DateTime(year, month, day); - DateTime result = AgeCalc.AgeCalcFunc(inputDate); + DateTime result = AgeCalc.AgeCalcFunc(inputDate, curDate); DateTime datemin = new DateTime(2, 2, 1); - DateTime curDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day); DateTime expect = new DateTime(curDate.Ticks - inputDate.Ticks - datemin.Ticks); Assert.Equal(expected: expect, actual: result); } diff --git a/CourseApp/AgeCalc.cs b/CourseApp/AgeCalc.cs index 2446220..46556a9 100644 --- a/CourseApp/AgeCalc.cs +++ b/CourseApp/AgeCalc.cs @@ -19,10 +19,8 @@ public static DateTime AgeInput() return inputDate; } - public static DateTime AgeCalcFunc(DateTime date) + public static DateTime AgeCalcFunc(DateTime date, DateTime curDate) { - DateTime curDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day); - if (date > curDate) { throw new IndexOutOfRangeException(); @@ -40,7 +38,8 @@ public static DateTime AgeCalcFunc(DateTime date) internal static void AgeMain() { - DateTime output = AgeCalcFunc(AgeInput()); + DateTime nowDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day); + DateTime output = AgeCalcFunc(AgeInput(), nowDate); Console.WriteLine(output); From 175b8c77fc1e528c719442d59df43758d3a11140 Mon Sep 17 00:00:00 2001 From: User of DK306 Date: Sat, 7 Mar 2020 19:23:06 +1400 Subject: [PATCH 08/10] added web --- CourseApp/Char.cs | 24 ++ CourseApp/Dish.cs | 5 +- CourseApp/Drink.cs | 1 + CourseApp/Food.cs | 8 +- CourseApp/Knight.cs | 20 ++ Web/landing/README.markdown | 4 + Web/landing/dist/index.html | 213 +++++++++++++++++ Web/landing/dist/style.css | 384 +++++++++++++++++++++++++++++++ Web/landing/license.txt | 8 + Web/landing/src/index.html | 199 ++++++++++++++++ Web/landing/src/style.css | 384 +++++++++++++++++++++++++++++++ Web/registration/README.markdown | 4 + Web/registration/dist/index.html | 50 ++++ Web/registration/dist/script.js | 63 +++++ Web/registration/dist/style.css | 59 +++++ Web/registration/license.txt | 8 + Web/registration/src/index.html | 35 +++ Web/registration/src/script.js | 65 ++++++ Web/registration/src/style.css | 59 +++++ 19 files changed, 1588 insertions(+), 5 deletions(-) create mode 100644 CourseApp/Char.cs create mode 100644 CourseApp/Knight.cs create mode 100644 Web/landing/README.markdown create mode 100644 Web/landing/dist/index.html create mode 100644 Web/landing/dist/style.css create mode 100644 Web/landing/license.txt create mode 100644 Web/landing/src/index.html create mode 100644 Web/landing/src/style.css create mode 100644 Web/registration/README.markdown create mode 100644 Web/registration/dist/index.html create mode 100644 Web/registration/dist/script.js create mode 100644 Web/registration/dist/style.css create mode 100644 Web/registration/license.txt create mode 100644 Web/registration/src/index.html create mode 100644 Web/registration/src/script.js create mode 100644 Web/registration/src/style.css diff --git a/CourseApp/Char.cs b/CourseApp/Char.cs new file mode 100644 index 0000000..f5350a5 --- /dev/null +++ b/CourseApp/Char.cs @@ -0,0 +1,24 @@ +using System; + +namespace CourseApp +{ + public class Player + { + private bool isDead; + private int hp; + + public Player(string name, bool isDead, int hp) + { + Hp = hp; + Name = name; + IsDead = isDead; + } + + public string Name { get; set; } + + public bool IsDead { get; set; } + + public int Hp { get; set; } + + } +} \ No newline at end of file diff --git a/CourseApp/Dish.cs b/CourseApp/Dish.cs index 29db4ff..d6104be 100644 --- a/CourseApp/Dish.cs +++ b/CourseApp/Dish.cs @@ -5,11 +5,12 @@ namespace CourseApp public class Dish : Food { public Dish() - : this(0, "Untitled", true) + : this("Untitled", 1, true) { } - public Dish(int rating, string name, bool isReady) + public Dish(string name, int rating, bool isReady) + : base(name, rating, isReady) { Name = name; Rating = rating; diff --git a/CourseApp/Drink.cs b/CourseApp/Drink.cs index e2d5555..a9adb20 100644 --- a/CourseApp/Drink.cs +++ b/CourseApp/Drink.cs @@ -12,6 +12,7 @@ public Drink() } public Drink(int rating, string name, bool isReady) + : base(name, rating, isReady) { Name = name; Rating = rating; diff --git a/CourseApp/Food.cs b/CourseApp/Food.cs index 9471596..9f386cc 100644 --- a/CourseApp/Food.cs +++ b/CourseApp/Food.cs @@ -8,14 +8,16 @@ public class Food private double weight; private double cal; - public Food() - : this(0, "Untitled", true) + public Food(int rating, string name, bool isReady) { + Name = name; + IsReady = isReady; } - public Food(int rating, string name, bool isReady) + public Food(string name, int rating, bool isReady) { Name = name; + this.rating = rating; IsReady = isReady; } diff --git a/CourseApp/Knight.cs b/CourseApp/Knight.cs new file mode 100644 index 0000000..0cca6ff --- /dev/null +++ b/CourseApp/Knight.cs @@ -0,0 +1,20 @@ +using System; + +namespace CourseApp +{ + public class Knight : Player + { + + private int maxHP; + + public Knight() + : this("Untitled") + { + } + + public Knight(string name) + : base(name, isDead, hp) + { + } + } +} \ No newline at end of file diff --git a/Web/landing/README.markdown b/Web/landing/README.markdown new file mode 100644 index 0000000..3175945 --- /dev/null +++ b/Web/landing/README.markdown @@ -0,0 +1,4 @@ +# + _A Pen created at CodePen.io. Original URL: [https://codepen.io/maxarclight/pen/oVVqpg](https://codepen.io/maxarclight/pen/oVVqpg). + + \ No newline at end of file diff --git a/Web/landing/dist/index.html b/Web/landing/dist/index.html new file mode 100644 index 0000000..8afe177 --- /dev/null +++ b/Web/landing/dist/index.html @@ -0,0 +1,213 @@ + + + + + CodePen - A Pen by Max Arclight + + + + + + + + + + + + +
+ +
+ +
+ + +
+
+ +
+
+

What kind of app would you like to build?

+
+ + +
+

AirDev is using smart automation to make high-quality custom software
accessible to everyone

+
+
+
+
+ +
+ +
+ +

ANY KIND OF APP

+

Browse our most popular categories

+
+ +
+ +

MARKETPLACE

+

Connecting pyers and sellers in
the sharing economy

+
+ +
+ +

SOCIAL NETWORK

+

Build connections and share
updates

+
+ +
+ +

DATA VISUALISATION

+

Analyze data through interactive
charts & dashboards

+
+ +
+ +

CRM / DATA MGMT

+

Manage customer or other
enterprise data

+
+
+ +
+

VIEV ALL

+ +
+
+ +
+

CUSTOM AT ANY PRICE POINT

+

See what Airbnb could look like for your budget

+ +
+ + + + +
+

$1k

+

$50k

+

$100k+

+
+
+
+

PRICE

+

$3k

+

5-7 days

+
+
+
+
+ +

Basic two-sided marketplace with host-managed listing, but transactions outside the app

+
+

3 User types:host, Renter, App owner

+

2 therd-party integtations (basic
analytics, chat support)

+
+

Standart AirDev responcive design
with custom logo & colors

+
+
+ +
+ +
+ +
+

A UNIQUE EXPERIENCE

+

Discover our redically different offering

+
+
+ + + + + +
+
+

Finally, Budgets you can trust and afford

+

> Fixed prices:

Hourly rates create bad incentives and frustration later on. We give you fixed quote for a scope , and stick to it

+ +

> Money-back gearantee:

if you are not satisfied with the work and want to quit, just return it for full refun of your last payment

+

> Dedicated capacity plans:

For complex and ongoing efforts, clients can reserve weekly capacity to tackle the highest prioriries as you evolve your roadmap

+ +
+
+

TRUSTED BY LEADING COMPANIES & ENTERPRENEURS

+
+ + + + + + +
+
+ + + +
+

"AirDev has been critical to our venture's progress. They truely offer a
seemingly impossible value proposion: they not only sit in the intersection
between quality,speed, and cost, but also bring business wits info the
progress. In the end, I truely considered AirDev our partners in our venture."

+

Andres Velez

+

Founder of Imuesto Correcto(Y Combinator W18)

+
+ + +
+ +
+ +
+
+

Bring your app idea to life! Start scorping your project today

+ +
+
+ + + + + + + + diff --git a/Web/landing/dist/style.css b/Web/landing/dist/style.css new file mode 100644 index 0000000..b7f6112 --- /dev/null +++ b/Web/landing/dist/style.css @@ -0,0 +1,384 @@ +body{ + + margin: 0; + padding: 0; +} + +header{ +margin-top:-3%; +background: #b8e1fc; + +background: linear-gradient(45deg, #b8e1fc 0%,#a9d2f3 34%,#90bcea 34%,#a9d2f3 34%,#90bff0 35%,#90bae4 35%,#90bae4 35%,#90bff0 35%,#90bff0 63%,#90bff0 63%,#6ba8e5 64%,#a2daf5 83%,#bdf3fd 100%); + + width:100%; + +} + +.header-bottom{ + display:flex; + color:white; + background:transparent; + margin:10%; + padding:0% 5% 15% 1%; +} +#img-right{ + height:600px; + + right:0%; + +} +.header-top{ + padding:5%; + display:flex; + color:white; + margin-top:1%; + background:transparent; + justify-content:space-between; +} +.logo{ + height:50px; + margin-left:5%; +} +.header-btns{ + display: flex; + color: white; +} + +.btn1{ + background:transparent; + color:white; + font-weight: 700; + padding: .5em 2em; + border: 2px solid; + border-radius:5%; + transition: 0.2s; +} + +.btn2{ + background:transparent; + color:white; + font-weight: 700; + padding: .5em 2em; + outline: none; + border: 0px solid; + transition: 0.2s; +} + +.input-section{ + display:flex; + align-items:center; + justify-content:space-between; + height:60px; + width:640px; + background:white; + border:2px solid white; + border-radius:10px; + padding-right:3%; +} + +.input{ + margin:0.65% 0.5%; + font-size:20px; + + width:80%; + border: 0px; + +} + +.arrow{ + height:16px; + margin-right:15%; + } + +////////////////////////////////////////////////////// + +main{ + +margin-top:0%; +} + +main{ + text-align:center; +background: linear-gradient(54deg, rgba(225,253,255,1) 0%, rgba(225,253,255,1) 81%, rgba(255,255,255,1) 81%); + +} + +.main-boxes{ + + margin:0% 15vw; + display:flex; + justify-content:space-between; + flex-wrap:wrap; +} + +.box{ + font-size:2vh; + box-shadow: 0px 0px 20px 0px rgba(50, 50, 50, 0.59); + height:30vh; + width:15vw; + text-align:center; + background:white; + border:2px solid white; + border-radius:5%; + padding-top:2vh; +} + + +.img-box{ + height:10vh; + +} +.top-block{ + margin-top:-11.15%; + padding-top:5%; +} +.greytext{ + + color:grey; +} +.flextext{ + display:flex; +} + +.vm-button{ + font-size:40px; + color:grey; + background:transparent; + border:2px solid grey; + padding:5px 15px; + border-radius:50%; + box-shadow: 0px 0px 20px 0px rgba(50, 50, 50, 0.15); +} + +.mid-block-1{ + margin-top:5%; + font-family:sans-sarif; + text-align:center; +} +.line{ + display: flex; + flex-direction:column; + jusify-content:space-between; + margin-left:20%; + width: 60%; +} +input[type=range] { + height: 25px; + -webkit-appearance: none; + margin: 0 0; + width: 100%; + background:transparent; +} +input[type=range]:focus { + outline: none; +} +input[type=range]::-webkit-slider-runnable-track { + width: 100%; + height: 3px; + cursor: pointer; + animate: 0.2s; + box-shadow: 0px 0px 0px #000000; + background: #2497E3; + border-radius: 1px; + border: 0px solid #000000; +} +input[type=range]::-webkit-slider-thumb { + box-shadow: 0px 0px 0px #000000; + height: 25px; + width: 25px; + border-radius: 25px; + background: #2497E3; + cursor: pointer; + -webkit-appearance: none; + margin-top: -11.2px; +} + +.values{ + display:flex; + justify-content:space-between; + font-family:sans-serif; + font-size:25px; +} + +#price{ + width:100%; + + + } + +.output{ + text-align:center; + font-size: 150%; + height:200px; + width:200px; + margin-left:23.5vw; + border:10px solid #46d9c1; + background: white ; + border-radius:50%; + z-index:5 ; +} + +#output{ + margin:-2vh; + font-size: 200%; +} + +#card1{ + margin-top:-12vh; +} +.card{ + box-shadow: 0px 0px 20px 0px rgba(50, 50, 50, 0.15); + border:5px solid white; + border-radius:25px; + margin-left:20%; + margin-right:20%; + background: white; + padding:5% 5% 2% 5%; + z-index:0; +} + +#card-content{ + font-size:80%; + color:black; + display:flex; + justify-content:space-between; +} + +.card-img{ + height:64px; +} + +#card3{ + display:flex; + justify-content:space-between; + padding:3%; +} +.logo2{ + + width:170px; + height:100px; +} +#lmbutton{ + margin-top:5%; + color:#57759B; + font-weight: 700; + padding: .5em 2em; + border: 2px solid #E2EAF7; + background:#E2EAF7; + border-radius:100px; + transition: 0.2s; +} +.section{ + height:30%; + width:100%; + + +} +#section1{ + background: rgb(184,225,252); +background: linear-gradient(45deg, rgba(255,255,255,1) 24%, rgba(225,253,255,1) 24%); +} +#section2{ + z-index:6; +background: linear-gradient(45deg, #b8e1fc 0%,#a9d2f3 34%,#90bcea 34%,#a9d2f3 34%,#90bff0 35%,#90bae4 35%,#90bae4 35%,#90bff0 35%,#90bff0 63%,#90bff0 63%,#6ba8e5 64%,#a2daf5 83%,#bdf3fd 100%); + + + display:flex; + + text-align:left; + +} +#section2-1{ + margin:10% ; +} +#c-image{ + margin:10% ; + height:320px; + border:0; + border-radius:50%; +} +#card2{ + text-align:left; + margin:10% 20%; +} + + +.btns2{ + margin-top:-8%; + display:flex; +} +#btns2-2{ + + color:grey; + font-weight: 700; + padding: .5em 1em; + border: 2px solid transparent; + background:transparent; + transition: 0.2s; +} +#block1{ + font-size:70%; + +} +#card3{ + position:relative; + z-index:5; + margin-bottom:-4%; +} +.btn4{ + margin-top:5%; + color:#57759B; + font-weight: 700; + padding: .3em 1em; + border: 3px solid black; + background:transparent; + border-radius:5px; + transition: 0.2s; +} +.icon{ + height:16px; +} + + +#mail-low{ + font-size:150%; + background: rgb(82,165,246); +background: linear-gradient(25deg, rgba(82,165,246,1) 31%, rgba(81,151,245,1) 31%, rgba(76,78,242,1) 67%, rgba(75,67,241,1) 67%); + display:flex; + text-align:center; + color:white; + padding:4%; + justify-content:space-between; +} +#button4{ + + color:white; + font-weight: 500; + margin-top:2%; + height:64px; + width:240px; + border: 0 solid ; + background:#ED3E43; + border-radius:50px; + transition: 0.2s; +} +.................................... + +footer{ + background:white; +} + +.footer-content{ + padding:5%; + display:flex; + justify-content:space-between; +} + +.fbox{ + +} + + +a{ + text-decoration:none; +} \ No newline at end of file diff --git a/Web/landing/license.txt b/Web/landing/license.txt new file mode 100644 index 0000000..d9422c6 --- /dev/null +++ b/Web/landing/license.txt @@ -0,0 +1,8 @@ +Copyright (c) 2020 by Max Arclight (https://codepen.io/maxarclight/pen/oVVqpg) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/Web/landing/src/index.html b/Web/landing/src/index.html new file mode 100644 index 0000000..aa5691b --- /dev/null +++ b/Web/landing/src/index.html @@ -0,0 +1,199 @@ + + + + + + + +
+ +
+ +
+ + +
+
+ +
+
+

What kind of app would you like to build?

+
+ + +
+

AirDev is using smart automation to make high-quality custom software
accessible to everyone

+
+
+
+
+ +
+ +
+ +

ANY KIND OF APP

+

Browse our most popular categories

+
+ +
+ +

MARKETPLACE

+

Connecting pyers and sellers in
the sharing economy

+
+ +
+ +

SOCIAL NETWORK

+

Build connections and share
updates

+
+ +
+ +

DATA VISUALISATION

+

Analyze data through interactive
charts & dashboards

+
+ +
+ +

CRM / DATA MGMT

+

Manage customer or other
enterprise data

+
+
+ +
+

VIEV ALL

+ +
+
+ +
+

CUSTOM AT ANY PRICE POINT

+

See what Airbnb could look like for your budget

+ +
+ + + + +
+

$1k

+

$50k

+

$100k+

+
+
+
+

PRICE

+

$3k

+

5-7 days

+
+
+
+
+ +

Basic two-sided marketplace with host-managed listing, but transactions outside the app

+
+

3 User types:host, Renter, App owner

+

2 therd-party integtations (basic
analytics, chat support)

+
+

Standart AirDev responcive design
with custom logo & colors

+
+
+ +
+ +
+ +
+

A UNIQUE EXPERIENCE

+

Discover our redically different offering

+
+
+ + + + + +
+
+

Finally, Budgets you can trust and afford

+

> Fixed prices:

Hourly rates create bad incentives and frustration later on. We give you fixed quote for a scope , and stick to it

+ +

> Money-back gearantee:

if you are not satisfied with the work and want to quit, just return it for full refun of your last payment

+

> Dedicated capacity plans:

For complex and ongoing efforts, clients can reserve weekly capacity to tackle the highest prioriries as you evolve your roadmap

+ +
+
+

TRUSTED BY LEADING COMPANIES & ENTERPRENEURS

+
+ + + + + + +
+
+ + + +
+

"AirDev has been critical to our venture's progress. They truely offer a
seemingly impossible value proposion: they not only sit in the intersection
between quality,speed, and cost, but also bring business wits info the
progress. In the end, I truely considered AirDev our partners in our venture."

+

Andres Velez

+

Founder of Imuesto Correcto(Y Combinator W18)

+
+ + +
+ +
+ +
+
+

Bring your app idea to life! Start scorping your project today

+ +
+
+ + + + \ No newline at end of file diff --git a/Web/landing/src/style.css b/Web/landing/src/style.css new file mode 100644 index 0000000..b7f6112 --- /dev/null +++ b/Web/landing/src/style.css @@ -0,0 +1,384 @@ +body{ + + margin: 0; + padding: 0; +} + +header{ +margin-top:-3%; +background: #b8e1fc; + +background: linear-gradient(45deg, #b8e1fc 0%,#a9d2f3 34%,#90bcea 34%,#a9d2f3 34%,#90bff0 35%,#90bae4 35%,#90bae4 35%,#90bff0 35%,#90bff0 63%,#90bff0 63%,#6ba8e5 64%,#a2daf5 83%,#bdf3fd 100%); + + width:100%; + +} + +.header-bottom{ + display:flex; + color:white; + background:transparent; + margin:10%; + padding:0% 5% 15% 1%; +} +#img-right{ + height:600px; + + right:0%; + +} +.header-top{ + padding:5%; + display:flex; + color:white; + margin-top:1%; + background:transparent; + justify-content:space-between; +} +.logo{ + height:50px; + margin-left:5%; +} +.header-btns{ + display: flex; + color: white; +} + +.btn1{ + background:transparent; + color:white; + font-weight: 700; + padding: .5em 2em; + border: 2px solid; + border-radius:5%; + transition: 0.2s; +} + +.btn2{ + background:transparent; + color:white; + font-weight: 700; + padding: .5em 2em; + outline: none; + border: 0px solid; + transition: 0.2s; +} + +.input-section{ + display:flex; + align-items:center; + justify-content:space-between; + height:60px; + width:640px; + background:white; + border:2px solid white; + border-radius:10px; + padding-right:3%; +} + +.input{ + margin:0.65% 0.5%; + font-size:20px; + + width:80%; + border: 0px; + +} + +.arrow{ + height:16px; + margin-right:15%; + } + +////////////////////////////////////////////////////// + +main{ + +margin-top:0%; +} + +main{ + text-align:center; +background: linear-gradient(54deg, rgba(225,253,255,1) 0%, rgba(225,253,255,1) 81%, rgba(255,255,255,1) 81%); + +} + +.main-boxes{ + + margin:0% 15vw; + display:flex; + justify-content:space-between; + flex-wrap:wrap; +} + +.box{ + font-size:2vh; + box-shadow: 0px 0px 20px 0px rgba(50, 50, 50, 0.59); + height:30vh; + width:15vw; + text-align:center; + background:white; + border:2px solid white; + border-radius:5%; + padding-top:2vh; +} + + +.img-box{ + height:10vh; + +} +.top-block{ + margin-top:-11.15%; + padding-top:5%; +} +.greytext{ + + color:grey; +} +.flextext{ + display:flex; +} + +.vm-button{ + font-size:40px; + color:grey; + background:transparent; + border:2px solid grey; + padding:5px 15px; + border-radius:50%; + box-shadow: 0px 0px 20px 0px rgba(50, 50, 50, 0.15); +} + +.mid-block-1{ + margin-top:5%; + font-family:sans-sarif; + text-align:center; +} +.line{ + display: flex; + flex-direction:column; + jusify-content:space-between; + margin-left:20%; + width: 60%; +} +input[type=range] { + height: 25px; + -webkit-appearance: none; + margin: 0 0; + width: 100%; + background:transparent; +} +input[type=range]:focus { + outline: none; +} +input[type=range]::-webkit-slider-runnable-track { + width: 100%; + height: 3px; + cursor: pointer; + animate: 0.2s; + box-shadow: 0px 0px 0px #000000; + background: #2497E3; + border-radius: 1px; + border: 0px solid #000000; +} +input[type=range]::-webkit-slider-thumb { + box-shadow: 0px 0px 0px #000000; + height: 25px; + width: 25px; + border-radius: 25px; + background: #2497E3; + cursor: pointer; + -webkit-appearance: none; + margin-top: -11.2px; +} + +.values{ + display:flex; + justify-content:space-between; + font-family:sans-serif; + font-size:25px; +} + +#price{ + width:100%; + + + } + +.output{ + text-align:center; + font-size: 150%; + height:200px; + width:200px; + margin-left:23.5vw; + border:10px solid #46d9c1; + background: white ; + border-radius:50%; + z-index:5 ; +} + +#output{ + margin:-2vh; + font-size: 200%; +} + +#card1{ + margin-top:-12vh; +} +.card{ + box-shadow: 0px 0px 20px 0px rgba(50, 50, 50, 0.15); + border:5px solid white; + border-radius:25px; + margin-left:20%; + margin-right:20%; + background: white; + padding:5% 5% 2% 5%; + z-index:0; +} + +#card-content{ + font-size:80%; + color:black; + display:flex; + justify-content:space-between; +} + +.card-img{ + height:64px; +} + +#card3{ + display:flex; + justify-content:space-between; + padding:3%; +} +.logo2{ + + width:170px; + height:100px; +} +#lmbutton{ + margin-top:5%; + color:#57759B; + font-weight: 700; + padding: .5em 2em; + border: 2px solid #E2EAF7; + background:#E2EAF7; + border-radius:100px; + transition: 0.2s; +} +.section{ + height:30%; + width:100%; + + +} +#section1{ + background: rgb(184,225,252); +background: linear-gradient(45deg, rgba(255,255,255,1) 24%, rgba(225,253,255,1) 24%); +} +#section2{ + z-index:6; +background: linear-gradient(45deg, #b8e1fc 0%,#a9d2f3 34%,#90bcea 34%,#a9d2f3 34%,#90bff0 35%,#90bae4 35%,#90bae4 35%,#90bff0 35%,#90bff0 63%,#90bff0 63%,#6ba8e5 64%,#a2daf5 83%,#bdf3fd 100%); + + + display:flex; + + text-align:left; + +} +#section2-1{ + margin:10% ; +} +#c-image{ + margin:10% ; + height:320px; + border:0; + border-radius:50%; +} +#card2{ + text-align:left; + margin:10% 20%; +} + + +.btns2{ + margin-top:-8%; + display:flex; +} +#btns2-2{ + + color:grey; + font-weight: 700; + padding: .5em 1em; + border: 2px solid transparent; + background:transparent; + transition: 0.2s; +} +#block1{ + font-size:70%; + +} +#card3{ + position:relative; + z-index:5; + margin-bottom:-4%; +} +.btn4{ + margin-top:5%; + color:#57759B; + font-weight: 700; + padding: .3em 1em; + border: 3px solid black; + background:transparent; + border-radius:5px; + transition: 0.2s; +} +.icon{ + height:16px; +} + + +#mail-low{ + font-size:150%; + background: rgb(82,165,246); +background: linear-gradient(25deg, rgba(82,165,246,1) 31%, rgba(81,151,245,1) 31%, rgba(76,78,242,1) 67%, rgba(75,67,241,1) 67%); + display:flex; + text-align:center; + color:white; + padding:4%; + justify-content:space-between; +} +#button4{ + + color:white; + font-weight: 500; + margin-top:2%; + height:64px; + width:240px; + border: 0 solid ; + background:#ED3E43; + border-radius:50px; + transition: 0.2s; +} +.................................... + +footer{ + background:white; +} + +.footer-content{ + padding:5%; + display:flex; + justify-content:space-between; +} + +.fbox{ + +} + + +a{ + text-decoration:none; +} \ No newline at end of file diff --git a/Web/registration/README.markdown b/Web/registration/README.markdown new file mode 100644 index 0000000..3324b87 --- /dev/null +++ b/Web/registration/README.markdown @@ -0,0 +1,4 @@ +# + _A Pen created at CodePen.io. Original URL: [https://codepen.io/maxarclight/pen/oRwrZW](https://codepen.io/maxarclight/pen/oRwrZW). + + \ No newline at end of file diff --git a/Web/registration/dist/index.html b/Web/registration/dist/index.html new file mode 100644 index 0000000..37bce34 --- /dev/null +++ b/Web/registration/dist/index.html @@ -0,0 +1,50 @@ + + + + + CodePen - A Pen by Max Arclight + + + + + + +
+

Регистрация

+
+
+

Имя :

+ +
+
+

Фамилия :

+ +
+
+

Email :

+ +
+
+

Пароль :

+ +
+
+

Повторите :

+ +
+

+ Зарегистрироваться +
+
+ +
+ +
+ + + + + + + + diff --git a/Web/registration/dist/script.js b/Web/registration/dist/script.js new file mode 100644 index 0000000..43d1208 --- /dev/null +++ b/Web/registration/dist/script.js @@ -0,0 +1,63 @@ +function signIn(){ + + var name=document.getElementById('input-name').value; + var surname=document.getElementById('input-surname').value; + var email=document.getElementById('input-email').value; + var password=document.getElementById('input-password').value; + var repass=document.getElementById('input-repassword').value; + + var error = document.getElementById('error'); + error.textContent=' '; + + if(name==""){ + return error.textContent='Введите имя'; + } + if(surname==""){ + return error.textContent='Введите фамилию'; + } + if(email==""){ + return error.textContent='Введите Email'; + } + if(password==""){ + return error.textContent='Введите Пароль'; + } + if(password.length!=0 && password.length<4){ + return error.textContent='Ваш пароль слишком короткий'; + } + var r=/[^A-Z-a-z-0-9]/g; + if(r.test(password))return error.textContent=' Введены недопустимые символы. Разрешены латинские буквы и цифры'; + if(repass!=password){ + return error.textContent='Пароли не совпадают'; + } + + + var form ={ + name:'', + surname:'', + email:'', + password:'' + } + + form.name=name; + form.surname=surname; + form.email=email; + form.password=password; + + + function result(input){ + var lu = document.getElementById('list') + var li = document.createElement('LI'); + var listText =document.createElement("p"); + var Text=document.createTextNode(input); + + listText.appendChild(Text); + li.appendChild(listText); + lu.appendChild(li); + } + + result(form.name); + result(form.surname); + result(form.email); + result(form.password); + +} \ No newline at end of file diff --git a/Web/registration/dist/style.css b/Web/registration/dist/style.css new file mode 100644 index 0000000..f5c97da --- /dev/null +++ b/Web/registration/dist/style.css @@ -0,0 +1,59 @@ +.container{ + text-align:center; + background:#e5e5e5; + margin:8% 30% 0% 30%; + padding:3% 5% 3% 5%; + border-radius:10px; +} +.input-section{ + margin-top:8%; + display:flex; + flex-direction:column; +} + +.input{ + border:1px solid transparent; + display:flex; + flex-direction:row; + justify-content:space-between; + 0.1vw +} + +.input input{ + margin-top:1.5%; + height:2vw; + width:20vw; + background:white; + border:1px solid lightgrey; + border-radius:5px; + padding-left:5px; + font-size:1vw; + +} +.input p{ + font-size:1vw; +} +span{ + padding:2.5%; + margin-top:30px; + color:white; + background:#01C9FB; + border:1px solid transparent; + border-radius:5px; + font-size:1vw; +} + +span:active{ + background:grey; +} + +.error{ + color:red; +} +li{ + list-style: none; +} + +h2{ + font-size:2vw; +} \ No newline at end of file diff --git a/Web/registration/license.txt b/Web/registration/license.txt new file mode 100644 index 0000000..5e3fffa --- /dev/null +++ b/Web/registration/license.txt @@ -0,0 +1,8 @@ +Copyright (c) 2020 by Max Arclight (https://codepen.io/maxarclight/pen/oRwrZW) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/Web/registration/src/index.html b/Web/registration/src/index.html new file mode 100644 index 0000000..7c35369 --- /dev/null +++ b/Web/registration/src/index.html @@ -0,0 +1,35 @@ + +
+

Регистрация

+
+
+

Имя :

+ +
+
+

Фамилия :

+ +
+
+

Email :

+ +
+
+

Пароль :

+ +
+
+

Повторите :

+ +
+

+ Зарегистрироваться +
+
+ +
+ +
+ + + \ No newline at end of file diff --git a/Web/registration/src/script.js b/Web/registration/src/script.js new file mode 100644 index 0000000..0ec0ff5 --- /dev/null +++ b/Web/registration/src/script.js @@ -0,0 +1,65 @@ +function signIn(){ + + var name=document.getElementById('input-name').value; + var surname=document.getElementById('input-surname').value; + var email=document.getElementById('input-email').value; + var password=document.getElementById('input-password').value; + var repass=document.getElementById('input-repassword').value; + + var error = document.getElementById('error'); + error.textContent=' '; + + if(name==""){ + return error.textContent='Введите имя'; + } + if(surname==""){ + return error.textContent='Введите фамилию'; + } + if(email==""){ + return error.textContent='Введите Email'; + } + if(password==""){ + return error.textContent='Введите Пароль'; + } + if(password.length!=0 && password.length<4){ + return error.textContent='Ваш пароль слишком короткий'; + } + var r=/[^A-Z-a-z-0-9]/g; + if(r.test(password))return error.textContent=' Введены недопустимые символы. Разрешены латинские буквы и цифры'; + if(repass!=password){ + return error.textContent='Пароли не совпадают'; + } + + + var form ={ + name:'', + surname:'', + email:'', + password:'' + } + + form.name=name; + form.surname=surname; + form.email=email; + form.password=password; + + + function result(input){ + var lu = document.getElementById('list') + var li = document.createElement('LI'); + var listText =document.createElement("p"); + var Text=document.createTextNode(input); + + listText.appendChild(Text); + li.appendChild(listText); + lu.appendChild(li); + } + + result(form.name); + result(form.surname); + result(form.email); + result(form.password); + +} + + diff --git a/Web/registration/src/style.css b/Web/registration/src/style.css new file mode 100644 index 0000000..f5c97da --- /dev/null +++ b/Web/registration/src/style.css @@ -0,0 +1,59 @@ +.container{ + text-align:center; + background:#e5e5e5; + margin:8% 30% 0% 30%; + padding:3% 5% 3% 5%; + border-radius:10px; +} +.input-section{ + margin-top:8%; + display:flex; + flex-direction:column; +} + +.input{ + border:1px solid transparent; + display:flex; + flex-direction:row; + justify-content:space-between; + 0.1vw +} + +.input input{ + margin-top:1.5%; + height:2vw; + width:20vw; + background:white; + border:1px solid lightgrey; + border-radius:5px; + padding-left:5px; + font-size:1vw; + +} +.input p{ + font-size:1vw; +} +span{ + padding:2.5%; + margin-top:30px; + color:white; + background:#01C9FB; + border:1px solid transparent; + border-radius:5px; + font-size:1vw; +} + +span:active{ + background:grey; +} + +.error{ + color:red; +} +li{ + list-style: none; +} + +h2{ + font-size:2vw; +} \ No newline at end of file From b05cfc08b68d0a017bd3564071375ec1bbe61d11 Mon Sep 17 00:00:00 2001 From: Maxim Date: Fri, 22 May 2020 10:34:46 +0300 Subject: [PATCH 09/10] added RPG files --- CourseApp.Tests/DemoTest.cs | 85 ++--------- CourseApp.Tests/PlatypusTest.cs | 55 +++++++ CourseApp/Char.cs | 24 --- CourseApp/Class/Player.cs | 73 +++++++++ CourseApp/Class/ReturnFuncs.cs | 50 +++++++ CourseApp/Class/Spells/BaseAttack.cs | 16 ++ CourseApp/Class/Spells/Hunter/Bandage.cs | 28 ++++ CourseApp/Class/Spells/Hunter/BullsEye.cs | 16 ++ CourseApp/Class/Spells/Hunter/DaggerThrow.cs | 16 ++ CourseApp/Class/Spells/IEffects.cs | 19 +++ CourseApp/Class/Spells/ISpell.cs | 13 ++ CourseApp/Class/Spells/Titan/FirstAidKit.cs | 28 ++++ CourseApp/Class/Spells/Titan/FistPunch.cs | 16 ++ CourseApp/Class/Spells/Titan/GrenadeThrow.cs | 16 ++ CourseApp/Class/Spells/Warlock/HealingRift.cs | 28 ++++ CourseApp/Class/Spells/Warlock/VoidBlast.cs | 16 ++ CourseApp/Class/Spells/Warlock/VoidSlash.cs | 16 ++ CourseApp/CourseApp.csproj | 4 + CourseApp/{ => Dish}/AgeCalc.cs | 0 CourseApp/{ => Dish}/Dish.cs | 0 CourseApp/{ => Dish}/Drink.cs | 0 CourseApp/{ => Dish}/Food.cs | 0 CourseApp/Knight.cs | 20 --- CourseApp/Program.cs | 141 ++++++++++-------- CourseApp/Rpg/Player.cs | 59 ++++++++ 25 files changed, 555 insertions(+), 184 deletions(-) create mode 100644 CourseApp.Tests/PlatypusTest.cs delete mode 100644 CourseApp/Char.cs create mode 100644 CourseApp/Class/Player.cs create mode 100644 CourseApp/Class/ReturnFuncs.cs create mode 100644 CourseApp/Class/Spells/BaseAttack.cs create mode 100644 CourseApp/Class/Spells/Hunter/Bandage.cs create mode 100644 CourseApp/Class/Spells/Hunter/BullsEye.cs create mode 100644 CourseApp/Class/Spells/Hunter/DaggerThrow.cs create mode 100644 CourseApp/Class/Spells/IEffects.cs create mode 100644 CourseApp/Class/Spells/ISpell.cs create mode 100644 CourseApp/Class/Spells/Titan/FirstAidKit.cs create mode 100644 CourseApp/Class/Spells/Titan/FistPunch.cs create mode 100644 CourseApp/Class/Spells/Titan/GrenadeThrow.cs create mode 100644 CourseApp/Class/Spells/Warlock/HealingRift.cs create mode 100644 CourseApp/Class/Spells/Warlock/VoidBlast.cs create mode 100644 CourseApp/Class/Spells/Warlock/VoidSlash.cs rename CourseApp/{ => Dish}/AgeCalc.cs (100%) rename CourseApp/{ => Dish}/Dish.cs (100%) rename CourseApp/{ => Dish}/Drink.cs (100%) rename CourseApp/{ => Dish}/Food.cs (100%) delete mode 100644 CourseApp/Knight.cs create mode 100644 CourseApp/Rpg/Player.cs diff --git a/CourseApp.Tests/DemoTest.cs b/CourseApp.Tests/DemoTest.cs index 9f7b133..61ea75a 100644 --- a/CourseApp.Tests/DemoTest.cs +++ b/CourseApp.Tests/DemoTest.cs @@ -5,87 +5,20 @@ namespace CourseApp.Tests { public class DemoTest { - [Theory] - [InlineData(7.2, 3.8, 1, 0)] - [InlineData(12.2, 4.5, 1, 0)] - [InlineData(20.2, 2.7, 1, 0)] - - public void TestForFunctionValues(double a, double b, double x, double exp) - { - var res = Program.MyFunction(a, b, x); - Assert.Equal(res, exp); - } - [Fact] - public void TestFunctionZeroVal() + public void Test1() { - var res = Program.MyFunction(0, 0, 0); - Assert.Equal(0, res, 3); + Assert.True(true); } [Theory] - [InlineData(7.2, 4.2, 1.81, 5.31, 0.7)] - [InlineData(3.2, 3.2, 1.5, 6.1, 0.5)] - [InlineData(4.1, 1.1, 0.3, 6.5, 1.0)] - - public void TestTaskAElements(double a, double b, double xn, double xk, double dx) - { - try - { - var res = Program.TaskA(a, b, xn, xk, dx); - double massElemExpected = (xk - xn) / dx; - Assert.Equal(expected: massElemExpected, actual: res.Count); - } - catch (IndexOutOfRangeException) - { - Console.WriteLine("Out Of Bounds"); - Assert.True(true); - } - } - - [Theory] - [InlineData(7.2, 4.2, 1.81, 5.31, 0.7)] - [InlineData(3.2, 3.2, 1.5, 6.1, 0.5)] - - public void TestATaskAllMoreThenZero(double a, double b, double xn, double xk, double dx) + [InlineData(0, 0, 0, 0)] + [InlineData(0, 2, 1, 2)] + [InlineData(1, 2, 1, 3)] + public void TestFunctionCalculationVal(double a, double b, double x, double exp) { - try - { - var res = Program.TaskA(a, b, xn, xk, dx); - - double massElemExpected = (xk - xn) / dx; - - Assert.Equal(expected: massElemExpected, actual: res.Count); - } - catch (IndexOutOfRangeException) - { - Console.WriteLine("Out Of Bounds"); - Assert.True(true); - } - catch (ArgumentOutOfRangeException) - { - Console.WriteLine("Argument Out Of Range"); - Assert.True(true); - } - } - - [Fact] - public void TestATaskTooLargeSteps() - { - var res = Program.TaskA(7.2, 4.2, 1.81, 5.31, 5); - int count = res.Count; - Assert.Equal(1, count); - } - - [Theory] - [InlineData(4.1, 2.7)] - [InlineData(5.2, 3.5)] - [InlineData(6.3, 1.3)] - public void TestTaskB(double a, double b) - { - double[] e = new double[0]; - var res = Program.TaskB(a, b, e); - Assert.Equal(res, new double[0]); + var res = Program.MyFunction(a, b, x); + Assert.Equal(exp, res, 3); } } -} \ No newline at end of file +} diff --git a/CourseApp.Tests/PlatypusTest.cs b/CourseApp.Tests/PlatypusTest.cs new file mode 100644 index 0000000..77c4d8f --- /dev/null +++ b/CourseApp.Tests/PlatypusTest.cs @@ -0,0 +1,55 @@ +using System; +using Xunit; + +namespace CourseApp.Tests +{ + public class PlatypusTest + { + [Fact] + public void TestEmptyConstructor() + { + var item = new Platypus(); + Assert.Equal(0, item.Age); + Assert.Equal("Untitled", item.Name); + Assert.True(item.IsMale); + } + + [Fact] + public void TestView() + { + var item = new Platypus(); + var view = @" + _.-^~~^^^`~-,_,,~''''''```~,''``~'``~, + ______,' -o :. _ . ; ,'`, `. +( -\.._,.;;'._ ,( } _`_-_,, `, `, + ``~~~~~~' ((/'((((____/~~~~~~'(,(,___> `~' + "; + Assert.Equal(view, item.View()); + } + + [Fact] + public void TestSetAge() + { + var item = new Platypus(); + item.Age = 5; + Assert.Equal(5, item.Age); + } + + [Fact] + public void TestIncorrectSetAge() + { + var item = new Platypus(); + item.Age = -5; + Assert.Equal(0, item.Age); + } + + [Fact] + public void TestCorrectIncorrectSetAge() + { + var item = new Platypus(); + item.Age = 10; + item.Age = -5; + Assert.Equal(10, item.Age); + } + } +} diff --git a/CourseApp/Char.cs b/CourseApp/Char.cs deleted file mode 100644 index f5350a5..0000000 --- a/CourseApp/Char.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; - -namespace CourseApp -{ - public class Player - { - private bool isDead; - private int hp; - - public Player(string name, bool isDead, int hp) - { - Hp = hp; - Name = name; - IsDead = isDead; - } - - public string Name { get; set; } - - public bool IsDead { get; set; } - - public int Hp { get; set; } - - } -} \ No newline at end of file diff --git a/CourseApp/Class/Player.cs b/CourseApp/Class/Player.cs new file mode 100644 index 0000000..729908c --- /dev/null +++ b/CourseApp/Class/Player.cs @@ -0,0 +1,73 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace CourseApp +{ + public class Player + { + private List sampleNames = new List() { "John", "James", "Arthur", "Samplename", "Nick", "Victor" }; + + public Player() + { + Name = SetName(); + Active = new List(); + Passive = new List(); + } + + public int PlayerMaxHp { get; set; } + + public string Name { get; set; } + + public string ClassName { get; set; } + + public int Strength { get; set; } + + public int Agility { get; set; } + + public int Intelligence { get; set; } + + public int CurrentHp { get; set; } + + public bool IsStunned { get; set; } + + public List Active { get; set; } + + public List Passive { get; set; } + + public int MaxHp + { + get { return this.PlayerMaxHp; } + set { this.PlayerMaxHp = 100 + (this.Strength / 2); } +} + + public string SetName() + { + Random rnd = new Random(); + + return sampleNames[rnd.Next(0, 5)]; + } + + public void Attack(Player target) + { + Random rnd = new Random(); + ISpell choise = this.Active[rnd.Next(0, this.Active.Count)]; + choise.Use(this, target); + } + + public void SetFullHp() + { + this.CurrentHp = 5 + (this.Strength / 2); + } + + public void SetClassName(string name) + { + this.ClassName = name; + } + + public void GetDamage(int dmg) + { + this.CurrentHp = this.CurrentHp - dmg; + } + } +} \ No newline at end of file diff --git a/CourseApp/Class/ReturnFuncs.cs b/CourseApp/Class/ReturnFuncs.cs new file mode 100644 index 0000000..f0fa5c8 --- /dev/null +++ b/CourseApp/Class/ReturnFuncs.cs @@ -0,0 +1,50 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace CourseApp +{ + public static class ReturnFuncs + { + public static List GetHunterSpells() + { + BaseAttack baseAttack = new BaseAttack { Name = "hand gun shot" }; + + Bandage bandage = new Bandage { Name = "Bandages" }; + + BullsEye bullsEye = new BullsEye { Name = "BullsEye" }; + + DaggerThrow daggerThrow = new DaggerThrow { Name = "Dagger throw" }; + List spells = new List() { baseAttack, bandage, bullsEye, daggerThrow }; + return spells; + } + + public static List GetTitanSpells() + { + BaseAttack baseAttack = new BaseAttack { Name = "Rifle shot" }; + + FirstAidKit firstAidKit = new FirstAidKit { Name = "first aid kit" }; + + FistPunch fistPunch = new FistPunch { Name = "Fist punch" }; + + GrenadeThrow grenadeThrow = new GrenadeThrow { Name = "Grenade throw" }; + + List spells = new List() { baseAttack, firstAidKit, fistPunch, grenadeThrow }; + return spells; + } + + public static List GetWarlockSpells() + { + BaseAttack baseAttack = new BaseAttack { Name = "hand gun shot" }; + + HealingRift healingRift = new HealingRift { Name = "Healing rift" }; + + VoidBlast voidBlast = new VoidBlast { Name = "Void blast" }; + + VoidSlash voidSlash = new VoidSlash { Name = "Void slash" }; + + List spells = new List() { baseAttack, healingRift, voidBlast, voidSlash }; + return spells; + } + } +} diff --git a/CourseApp/Class/Spells/BaseAttack.cs b/CourseApp/Class/Spells/BaseAttack.cs new file mode 100644 index 0000000..398263a --- /dev/null +++ b/CourseApp/Class/Spells/BaseAttack.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace CourseApp +{ + public class BaseAttack : ISpell + { + public string Name { get; set; } + + public void Use(Player caster, Player target) + { + target.GetDamage(caster.Strength); + } + } +} diff --git a/CourseApp/Class/Spells/Hunter/Bandage.cs b/CourseApp/Class/Spells/Hunter/Bandage.cs new file mode 100644 index 0000000..3566cdf --- /dev/null +++ b/CourseApp/Class/Spells/Hunter/Bandage.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace CourseApp +{ + public class Bandage : ISpell + { + public string Name { get; set; } + + public void Use(Player caster, Player target) + { + if ((caster.CurrentHp + 5) < caster.PlayerMaxHp) + { + caster.CurrentHp = caster.CurrentHp + 5; + } + else + { + Console.WriteLine("HP is FULL"); + } + + if (caster.CurrentHp > caster.PlayerMaxHp) + { + caster.CurrentHp = caster.PlayerMaxHp; + } + } + } +} diff --git a/CourseApp/Class/Spells/Hunter/BullsEye.cs b/CourseApp/Class/Spells/Hunter/BullsEye.cs new file mode 100644 index 0000000..90171fa --- /dev/null +++ b/CourseApp/Class/Spells/Hunter/BullsEye.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace CourseApp +{ + public class BullsEye : ISpell + { + public string Name { get; set; } + + public void Use(Player caster, Player target) + { + target.CurrentHp = target.CurrentHp - (10 * (caster.Agility / 2)); + } + } +} diff --git a/CourseApp/Class/Spells/Hunter/DaggerThrow.cs b/CourseApp/Class/Spells/Hunter/DaggerThrow.cs new file mode 100644 index 0000000..7e2b8b2 --- /dev/null +++ b/CourseApp/Class/Spells/Hunter/DaggerThrow.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace CourseApp +{ + public class DaggerThrow : ISpell + { + public string Name { get; set; } + + public void Use(Player caster, Player target) + { + target.GetDamage(15 * ((caster.Agility + caster.Strength) / 2)); + } + } +} diff --git a/CourseApp/Class/Spells/IEffects.cs b/CourseApp/Class/Spells/IEffects.cs new file mode 100644 index 0000000..f9c0568 --- /dev/null +++ b/CourseApp/Class/Spells/IEffects.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace CourseApp +{ + public interface IEffects + { + string Name { get; set; } + + int Duration { get; set; } + + void Heal(Player target); + + void Damage(Player target); + + void Boost(Player target); + } +} diff --git a/CourseApp/Class/Spells/ISpell.cs b/CourseApp/Class/Spells/ISpell.cs new file mode 100644 index 0000000..a8a9d44 --- /dev/null +++ b/CourseApp/Class/Spells/ISpell.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace CourseApp +{ + public interface ISpell + { + string Name { get; set; } + + void Use(Player caster, Player target); + } +} diff --git a/CourseApp/Class/Spells/Titan/FirstAidKit.cs b/CourseApp/Class/Spells/Titan/FirstAidKit.cs new file mode 100644 index 0000000..a9ee6e0 --- /dev/null +++ b/CourseApp/Class/Spells/Titan/FirstAidKit.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace CourseApp +{ + public class FirstAidKit : ISpell + { + public string Name { get; set; } + + public void Use(Player caster, Player target) + { + if ((caster.CurrentHp + 5) < caster.PlayerMaxHp) + { + caster.CurrentHp = caster.CurrentHp + 5; + } + else + { + Console.WriteLine("HP is FULL"); + } + + if (caster.CurrentHp > caster.PlayerMaxHp) + { + caster.CurrentHp = caster.PlayerMaxHp; + } + } + } +} diff --git a/CourseApp/Class/Spells/Titan/FistPunch.cs b/CourseApp/Class/Spells/Titan/FistPunch.cs new file mode 100644 index 0000000..fa5fab1 --- /dev/null +++ b/CourseApp/Class/Spells/Titan/FistPunch.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace CourseApp +{ + public class FistPunch : ISpell + { + public string Name { get; set; } + + public void Use(Player caster, Player target) + { + target.CurrentHp = target.CurrentHp - (10 * (caster.Agility / 2)); + } + } +} \ No newline at end of file diff --git a/CourseApp/Class/Spells/Titan/GrenadeThrow.cs b/CourseApp/Class/Spells/Titan/GrenadeThrow.cs new file mode 100644 index 0000000..3955f10 --- /dev/null +++ b/CourseApp/Class/Spells/Titan/GrenadeThrow.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace CourseApp +{ + public class GrenadeThrow : ISpell + { + public string Name { get; set; } + + public void Use(Player caster, Player target) + { + target.GetDamage(15 * (caster.Strength / 2)); + } + } +} diff --git a/CourseApp/Class/Spells/Warlock/HealingRift.cs b/CourseApp/Class/Spells/Warlock/HealingRift.cs new file mode 100644 index 0000000..96a935d --- /dev/null +++ b/CourseApp/Class/Spells/Warlock/HealingRift.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace CourseApp +{ + public class HealingRift : ISpell + { + public string Name { get; set; } + + public void Use(Player caster, Player target) + { + if ((caster.CurrentHp + 5) < caster.PlayerMaxHp) + { + caster.CurrentHp = caster.CurrentHp + 5; + } + else + { + Console.WriteLine("HP is FULL"); + } + + if (caster.CurrentHp > caster.PlayerMaxHp) + { + caster.CurrentHp = caster.PlayerMaxHp; + } + } + } +} diff --git a/CourseApp/Class/Spells/Warlock/VoidBlast.cs b/CourseApp/Class/Spells/Warlock/VoidBlast.cs new file mode 100644 index 0000000..6a54a41 --- /dev/null +++ b/CourseApp/Class/Spells/Warlock/VoidBlast.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace CourseApp +{ + public class VoidBlast : ISpell + { + public string Name { get; set; } + + public void Use(Player caster, Player target) + { + target.GetDamage(15 * (caster.Intelligence / 2)); + } + } +} diff --git a/CourseApp/Class/Spells/Warlock/VoidSlash.cs b/CourseApp/Class/Spells/Warlock/VoidSlash.cs new file mode 100644 index 0000000..5d50330 --- /dev/null +++ b/CourseApp/Class/Spells/Warlock/VoidSlash.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace CourseApp +{ + public class VoidSlash : ISpell + { + public string Name { get; set; } + + public void Use(Player caster, Player target) + { + target.CurrentHp = target.CurrentHp - (10 * (caster.Agility / 2)); + } + } +} diff --git a/CourseApp/CourseApp.csproj b/CourseApp/CourseApp.csproj index b244e47..b72ac90 100644 --- a/CourseApp/CourseApp.csproj +++ b/CourseApp/CourseApp.csproj @@ -20,4 +20,8 @@ + + + + diff --git a/CourseApp/AgeCalc.cs b/CourseApp/Dish/AgeCalc.cs similarity index 100% rename from CourseApp/AgeCalc.cs rename to CourseApp/Dish/AgeCalc.cs diff --git a/CourseApp/Dish.cs b/CourseApp/Dish/Dish.cs similarity index 100% rename from CourseApp/Dish.cs rename to CourseApp/Dish/Dish.cs diff --git a/CourseApp/Drink.cs b/CourseApp/Dish/Drink.cs similarity index 100% rename from CourseApp/Drink.cs rename to CourseApp/Dish/Drink.cs diff --git a/CourseApp/Food.cs b/CourseApp/Dish/Food.cs similarity index 100% rename from CourseApp/Food.cs rename to CourseApp/Dish/Food.cs diff --git a/CourseApp/Knight.cs b/CourseApp/Knight.cs deleted file mode 100644 index 0cca6ff..0000000 --- a/CourseApp/Knight.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; - -namespace CourseApp -{ - public class Knight : Player - { - - private int maxHP; - - public Knight() - : this("Untitled") - { - } - - public Knight(string name) - : base(name, isDead, hp) - { - } - } -} \ No newline at end of file diff --git a/CourseApp/Program.cs b/CourseApp/Program.cs index 5824efb..46b9c5e 100644 --- a/CourseApp/Program.cs +++ b/CourseApp/Program.cs @@ -1,105 +1,118 @@ using System; -using System.Collections; using System.Collections.Generic; namespace CourseApp { public class Program { - public static double MyFunction(double a, double b, double x) + public static void Combat(List fighters) { - if (a == 0 && b == 0 && x == 0) + Random rnd = new Random(); + int val = rnd.Next(1, fighters.Count); + + foreach (Player fighter in fighters) { - return 0; + fighter.SetFullHp(); } - double upper = a - (b * x); - upper = Math.Abs(upper); - - double lower = Math.Log10(x); - lower = Math.Pow(lower, 3); - - double y; - y = upper / lower; - y = Math.Pow(y, -2); - return y; - } - - public static ArrayList TaskA(double a, double b, double xn, double xk, double dx) - { - double mas = (xk - xn) / dx; - - ArrayList y = new ArrayList((int)mas); + while (fighters.Count > 1) + { + Player a = fighters[rnd.Next(0, fighters.Count)]; + fighters.Remove(a); - // double[] y = new double[(int)mas]; - ArrayList preExitY = new ArrayList(); + Player b = fighters[rnd.Next(0, fighters.Count)]; + fighters.Remove(b); - if ((xk - xn) < dx) - { - preExitY.Add(MyFunction(a, b, xn)); + a.SetFullHp(); + b.SetFullHp(); + while (a == b) + { + a = fighters[rnd.Next(0, fighters.Count)]; + b = fighters[rnd.Next(0, fighters.Count)]; + } - foreach (double obj in preExitY) + while ((a.CurrentHp != 0) || (b.CurrentHp != 0)) { - if (obj < 0) + Console.WriteLine(a.Name); + Console.WriteLine(a.CurrentHp); + a.Attack(b); + Console.WriteLine(b.Name); + Console.WriteLine(b.CurrentHp); + b.Attack(a); + if (a.CurrentHp <= 0) { - throw new ArgumentOutOfRangeException("y"); + fighters.Add(b); + break; + } + else if (b.CurrentHp <= 0) + { + fighters.Add(a); + break; } } - - return preExitY; } - for (double x = xn; x <= xk; x += dx) - { - y.Add(MyFunction(a, b, x)); - } + Console.WriteLine(); + Console.ReadKey(); + } - if ((xk - xn) / dx != y.Count) - { - throw new IndexOutOfRangeException("y"); - } + public static List FighterGenerator(int count) + { + List fighters = new List(); - foreach (double obj in y) + for (int i = 0; i < count; i++) { - if (obj < 0) + Player fighter = new Player(); + + Random rnd = new Random(); + int val = rnd.Next(1, 3); + + switch (val) { - throw new ArgumentOutOfRangeException("y"); + case 1: + fighter.SetClassName("Hunter"); + fighter.Active = ReturnFuncs.GetHunterSpells(); + break; + case 2: + fighter.SetClassName("Titan"); + fighter.Active = ReturnFuncs.GetTitanSpells(); + break; + case 3: + fighter.SetClassName("Warlock"); + fighter.Active = ReturnFuncs.GetWarlockSpells(); + break; } - } - return y; - } + fighter.Strength = rnd.Next(10, 100); + fighter.Agility = rnd.Next(10, 100); + fighter.Intelligence = rnd.Next(10, 100); - public static double[] TaskB(double a, double b, double[] x) - { - var y = new double[x.Length]; - for (var i = 0; i < x.Length; i++) - { - y[i] = MyFunction(a, b, x[i]); + fighter.SetName(); + fighters.Add(fighter); } - return y; + return fighters; } public static void Main(string[] args) { - Console.WriteLine("Hello World!"); + Player sample = new Player(); + Random rnd = new Random(); + int val = rnd.Next(2, 10); + + List fighters = new List(); + fighters = FighterGenerator(val); + + Combat(fighters); - TaskA(7.2, 4.2, 1.81, 5.31, 0.7); + Console.WriteLine(fighters[0]); - const double a = 2.2; - const double b = 3.8; - var resSingle = MyFunction(a, b, 4); - Console.WriteLine(resSingle); - var x = new double[] { 1, 2, 3, 4, 5 }; - var taskBRes = TaskB(a, b, x); - foreach (var item in taskBRes) + foreach (Player fighter in fighters) { - Console.WriteLine($"y = {item}"); + Console.WriteLine(fighter.Name); } - AgeCalc.AgeMain(); Console.ReadLine(); } } -} \ No newline at end of file +} diff --git a/CourseApp/Rpg/Player.cs b/CourseApp/Rpg/Player.cs new file mode 100644 index 0000000..bae5159 --- /dev/null +++ b/CourseApp/Rpg/Player.cs @@ -0,0 +1,59 @@ +using System; +using System.Collections.Generic; + +namespace CourseApp +{ + public class Player + { + private List sampleNames = new List() { "John", "James", "Arthur", "Samplename", "Nick", "Victor" }; + + public Player() + { + + Name = SetName(); + Active = new List(); + Passive = new List(); + } + + public string Name + { + get + { + return this.name; + } + } + + public void SetName() + { + Random rnd = new Random(); + + this.name = sampleNames[rnd.Next(0, 5)]; + } + + public void SetClassName(string name) { this.className = name; } + + public List<> Active { get; set; } + + public List<> Passive { get; set; } + + public int Strength { get; set; } + + public int Agility { get; set; } + + public int Intelligence { get; set; } + + public int SetMaxHp() { + this.hp = 5 + this.strength / 2; + } + + public int CurrentHp { get; set; } + + public void GetDamage(int dmg) { + this.CurrentHp = this.CurrentHp - dmg; + } + + + + public bool IsStunned { get; set; } + } +} \ No newline at end of file From c12a9e1870adfdb1315af4ea032204694fb14292 Mon Sep 17 00:00:00 2001 From: Maxim Date: Mon, 25 May 2020 09:33:28 +0300 Subject: [PATCH 10/10] fixed --- CourseApp.Tests/AgeTest.cs | 36 --------- CourseApp.Tests/DishTest.cs | 148 ------------------------------------ CourseApp/Dish/AgeCalc.cs | 49 ------------ CourseApp/Dish/Dish.cs | 26 ------- CourseApp/Dish/Drink.cs | 42 ---------- CourseApp/Dish/Food.cs | 88 --------------------- CourseApp/Rpg/Player.cs | 59 -------------- 7 files changed, 448 deletions(-) delete mode 100644 CourseApp.Tests/AgeTest.cs delete mode 100644 CourseApp.Tests/DishTest.cs delete mode 100644 CourseApp/Dish/AgeCalc.cs delete mode 100644 CourseApp/Dish/Dish.cs delete mode 100644 CourseApp/Dish/Drink.cs delete mode 100644 CourseApp/Dish/Food.cs delete mode 100644 CourseApp/Rpg/Player.cs diff --git a/CourseApp.Tests/AgeTest.cs b/CourseApp.Tests/AgeTest.cs deleted file mode 100644 index a8a536f..0000000 --- a/CourseApp.Tests/AgeTest.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System; -using Xunit; - -namespace CourseApp.Tests -{ - public class AgeTest - { - [Theory] - [InlineData(2000, 11, 26)] - [InlineData(7000, 4, 5)] - [InlineData(2019, 12, 21)] - - public void TestForAgeCalcValues(int year, int month, int day) - { - try - { - DateTime curDate = new DateTime(2019, 12, 11); - DateTime inputDate = new DateTime(year, month, day); - DateTime result = AgeCalc.AgeCalcFunc(inputDate, curDate); - DateTime datemin = new DateTime(2, 2, 1); - DateTime expect = new DateTime(curDate.Ticks - inputDate.Ticks - datemin.Ticks); - Assert.Equal(expected: expect, actual: result); - } - catch (IndexOutOfRangeException outOfRange) - { - Console.WriteLine(outOfRange.Message); - Assert.True(true); - } - catch (ArgumentException argEx) - { - Console.WriteLine(argEx.Message); - Assert.True(true); - } - } - } -} \ No newline at end of file diff --git a/CourseApp.Tests/DishTest.cs b/CourseApp.Tests/DishTest.cs deleted file mode 100644 index 45b1d04..0000000 --- a/CourseApp.Tests/DishTest.cs +++ /dev/null @@ -1,148 +0,0 @@ -using System; -using Xunit; - -namespace CourseApp.Tests -{ - public class DishTest - { - [Fact] - public void TestEmptyConstructor() - { - var item = new Dish(); - Assert.Equal(0, item.Weight); - Assert.Equal("Untitled", item.Name); - Assert.True(item.IsReady); - } - - [Fact] - public void TestSetWeight() - { - try - { - var item = new Dish(); - item.Weight = 255; - } - catch (ArgumentOutOfRangeException outOfRange) - { - Console.WriteLine(outOfRange.Message); - Assert.True(true); - } - } - - [Fact] - public void TestSetCal() - { - try - { - var item = new Dish(); - item.Cal = 225; - } - catch (ArgumentOutOfRangeException outOfRange) - { - Console.WriteLine(outOfRange.Message); - Assert.True(true); - } - } - - [Fact] - public void TestSetRating() - { - try - { - var item = new Dish(); - item.Rating = 50; - } - catch (ArgumentOutOfRangeException outOfRange) - { - Console.WriteLine(outOfRange.Message); - Assert.True(true); - } - } - - [Fact] - public void TestIncorrectSetWeight() - { - try - { - var item = new Dish(); - item.Weight = -5; - } - catch (ArgumentOutOfRangeException outOfRange) - { - Console.WriteLine(outOfRange.Message); - Assert.True(true); - } - } - - [Fact] - public void TestCorrectIncorrectSetWeight() - { - try - { - var item = new Dish(); - item.Weight = -5; - } - catch (ArgumentOutOfRangeException outOfRange) - { - Console.WriteLine(outOfRange.Message); - Assert.True(true); - } - } - - [Fact] - public void TestCorrectIncorrectSetCal() - { - try - { - var item = new Dish(); - item.Cal = -5; - } - catch (ArgumentOutOfRangeException outOfRange) - { - Console.WriteLine(outOfRange.Message); - Assert.True(true); - } - } - - [Fact] - public void TestStats() - { - var item = new Dish(); - bool bl = item.Cook(); - Assert.True(bl); - } - - [Fact] - public void TestDrinkVolume() - { - try - { - var item = new Drink(); - item.Volume = 15; - Assert.Equal(15, item.Volume); - var item2 = new Drink(); - item2.Volume = -5; - } - catch (ArgumentOutOfRangeException outOfRange) - { - Console.WriteLine(outOfRange.Message); - Assert.True(true); - } - } - - [Fact] - public void TestDrinkIncorrectVolume() - { - try - { - var item = new Drink(); - item.Volume = -5; - } - catch (ArgumentOutOfRangeException outOfRange) - { - Console.WriteLine(outOfRange.Message); - Assert.True(true); - } - } - } -} \ No newline at end of file diff --git a/CourseApp/Dish/AgeCalc.cs b/CourseApp/Dish/AgeCalc.cs deleted file mode 100644 index 46556a9..0000000 --- a/CourseApp/Dish/AgeCalc.cs +++ /dev/null @@ -1,49 +0,0 @@ -using System; - -namespace CourseApp -{ - public class AgeCalc - { - public static DateTime AgeInput() - { - Console.WriteLine("input year"); - int year = Convert.ToInt32(Console.ReadLine()); - - Console.WriteLine("input month"); - int month = Convert.ToInt32(Console.ReadLine()); - - Console.WriteLine("input day"); - int day = Convert.ToInt32(Console.ReadLine()); - - DateTime inputDate = new DateTime(year, month, day); - return inputDate; - } - - public static DateTime AgeCalcFunc(DateTime date, DateTime curDate) - { - if (date > curDate) - { - throw new IndexOutOfRangeException(); - } - - if (date == curDate) - { - throw new ArgumentException(); - } - - DateTime datemin = new DateTime(2, 2, 1); - DateTime age = new DateTime(curDate.Ticks - date.Ticks - datemin.Ticks); - return age; - } - - internal static void AgeMain() - { - DateTime nowDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day); - DateTime output = AgeCalcFunc(AgeInput(), nowDate); - - Console.WriteLine(output); - - Console.ReadLine(); - } - } -} \ No newline at end of file diff --git a/CourseApp/Dish/Dish.cs b/CourseApp/Dish/Dish.cs deleted file mode 100644 index d6104be..0000000 --- a/CourseApp/Dish/Dish.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System; - -namespace CourseApp -{ - public class Dish : Food - { - public Dish() - : this("Untitled", 1, true) - { - } - - public Dish(string name, int rating, bool isReady) - : base(name, rating, isReady) - { - Name = name; - Rating = rating; - IsReady = isReady; - } - - public bool Cook() - { - this.IsReady = true; - return this.IsReady; - } - } -} \ No newline at end of file diff --git a/CourseApp/Dish/Drink.cs b/CourseApp/Dish/Drink.cs deleted file mode 100644 index a9adb20..0000000 --- a/CourseApp/Dish/Drink.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System; - -namespace CourseApp -{ - public class Drink : Food - { - private double volume; - - public Drink() - : this(0, "Untitled", true) - { - } - - public Drink(int rating, string name, bool isReady) - : base(name, rating, isReady) - { - Name = name; - Rating = rating; - IsReady = isReady; - } - - public double Volume - { - get - { - return this.volume; - } - - set - { - if (value >= 0) - { - this.volume = value; - } - else - { - throw new ArgumentOutOfRangeException("value", "Weight should be > 0"); - } - } - } - } -} \ No newline at end of file diff --git a/CourseApp/Dish/Food.cs b/CourseApp/Dish/Food.cs deleted file mode 100644 index 9f386cc..0000000 --- a/CourseApp/Dish/Food.cs +++ /dev/null @@ -1,88 +0,0 @@ -using System; - -namespace CourseApp -{ - public class Food - { - private int rating; - private double weight; - private double cal; - - public Food(int rating, string name, bool isReady) - { - Name = name; - IsReady = isReady; - } - - public Food(string name, int rating, bool isReady) - { - Name = name; - this.rating = rating; - IsReady = isReady; - } - - public string Name { get; set; } - - public bool IsReady { get; set; } - - public int Rating - { - get - { - return this.rating; - } - - set - { - if (value >= 0 && value < 100) - { - this.rating = value; - } - else - { - throw new ArgumentOutOfRangeException("value", "Rating should be > 0 and < than 100"); - } - } - } - - public double Weight - { - get - { - return this.weight; - } - - set - { - if (value >= 0) - { - this.weight = value; - } - else - { - throw new ArgumentOutOfRangeException("value", "Weight should be > 0"); - } - } - } - - public double Cal - { - get - { - return this.cal; - } - - set - { - if (value >= 0) - { - this.cal = value; - } - else - { - throw new ArgumentOutOfRangeException("value", "Calories should be > 0"); - } - } - } - } -} \ No newline at end of file diff --git a/CourseApp/Rpg/Player.cs b/CourseApp/Rpg/Player.cs deleted file mode 100644 index bae5159..0000000 --- a/CourseApp/Rpg/Player.cs +++ /dev/null @@ -1,59 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace CourseApp -{ - public class Player - { - private List sampleNames = new List() { "John", "James", "Arthur", "Samplename", "Nick", "Victor" }; - - public Player() - { - - Name = SetName(); - Active = new List(); - Passive = new List(); - } - - public string Name - { - get - { - return this.name; - } - } - - public void SetName() - { - Random rnd = new Random(); - - this.name = sampleNames[rnd.Next(0, 5)]; - } - - public void SetClassName(string name) { this.className = name; } - - public List<> Active { get; set; } - - public List<> Passive { get; set; } - - public int Strength { get; set; } - - public int Agility { get; set; } - - public int Intelligence { get; set; } - - public int SetMaxHp() { - this.hp = 5 + this.strength / 2; - } - - public int CurrentHp { get; set; } - - public void GetDamage(int dmg) { - this.CurrentHp = this.CurrentHp - dmg; - } - - - - public bool IsStunned { get; set; } - } -} \ No newline at end of file