private void button5_Click(object sender, EventArgs e) { Addition addition = new Addition(); AlgRandom algGenerate = new AlgRandom(); switch (algIndex) { case 0: map = addition.Add(map, algGenerate.Generate(Int32.Parse(textBox1.Text))); DisplacementMap.Image = map; break; case 1: AlgPerlin perlin = new AlgPerlin(); map = addition.AddPerlin(map, perlin.Generate(Int32.Parse(textBox1.Text), Int32.Parse(textBox1.Text))); DisplacementMap.Image = map; break; } listBox1.Items.Add($"X = {Int32.Parse(textBox1.Text)}; Y = {Int32.Parse(textBox1.Text)}"); listBox1.Items.Add(""); DisplacementMap.Image = map; }
public void EmptyListTest() { Addition a = new Addition(); List <float> values = null; _ = a.Add(values); }
public Node ExprAdd() { Node expressionMul = ExprMul(); while (additionOperators.Contains(CurrentToken)) { Node expressionAdd = new Addition() { AnchorToken = OpAdd() }; expressionAdd.Add(expressionMul); expressionAdd.Add(ExprMul()); return(expressionAdd); } return(expressionMul); }
static void Main(string[] args) { int a = 100; int b = 10; int res = Addition.Add(a, b); Console.WriteLine(res); }
public static dynamic Mean(dynamic values) { var sum = Addition.Add(values); var valueCount = Helpers.Array.Length(values); var mean = Division.Divide(sum, valueCount); return(mean); }
public int GetAverageMarks(int marks1, int marks2, int mark3) { //create object of inner class Addition addition = new Addition(); int total = addition.Add(marks1, marks2, mark3); return(total / 3); }
static void Main1(string[] args) { bool control = true; while (control) { try { Console.WriteLine("Select Option:"); Console.WriteLine("1.Addition\n2.Subtraction\n3.Multiplication\n4.Division\n5.stop"); decimal option = Convert.ToDecimal(Console.ReadLine()); if (option == 5) { break; } Console.Write("Enter Number1:"); decimal number1 = Convert.ToDecimal(Console.ReadLine()); Console.Write("Enter Number2:"); decimal number2 = Convert.ToDecimal(Console.ReadLine()); if (option == 1) { Addition addition = new Addition(); // addition.Age = -5; //addition. //Console.WriteLine(addition.Age); addition.Add(number1, number2); } else if (option == 2) { Subtraction subtraction = new Subtraction(); subtraction.Subtract(number1, number2); } else if (option == 3) { Multiplication multiplication = new Multiplication(); multiplication.Multiply(number1, number2); } else if (option == 4) { Division division = new Division(); division.Divide(number1, number2); } else { Console.WriteLine("Enter right option"); Console.WriteLine("\n"); } } catch (Exception ex) { Console.WriteLine(ex.Message); Console.WriteLine(ex.Data); } } }
public static void Main() { Computation com = new Computation(10, 20); Addition add = (Addition)com; Console.WriteLine("Sum = " + add.Add()); Multiplication mlt = (Multiplication)com; Console.WriteLine("Product= " + mlt.Multi()); }
public void WhenAddingTwoValues_ShouldReturnValueTotal() { // ARRANGE var addition = new Addition(); // ACT var result = addition.Add(1, 2); // ASSERT Assert.AreEqual(result, 3); }
public void Addition_CanAdd() { //Arrange int expected = 5; Addition a = new Addition(); //Act int actual = a.Add(2, 3); //Assert Assert.AreEqual(expected, actual); }
public void IsResultCorrect() { // Arrange List <float> values = new List <float>() { 2, 3 }; // Act Addition a = new Addition(); float sum = a.Add(values); // Assert Assert.IsTrue(sum == 5); }
/// <summary> /// Reads two float values converts them to binary,adds the two binary Numbers /// sand Converts the result to float again /// </summary> /// <param name="args"></param> static void Main(string[] args) { double firstNumber, secondNumber, result, binarySum, binaryFirst, binarySecond; Console.WriteLine("Enter the two numbers to be added: "); firstNumber = Convert.ToDouble(Console.ReadLine()); secondNumber = Convert.ToDouble(Console.ReadLine()); FloatTobinary fTob = new FloatTobinary(); binaryFirst = fTob.Conversion(firstNumber); binarySecond = fTob.Conversion(secondNumber); Addition add = new Addition(); binarySum = add.Add(binaryFirst, binarySecond); BinaryToFloat BTof = new BinaryToFloat(); result = BTof.ReverseConversion(binarySum); Console.WriteLine("the sum of Numbers is " + result); Console.ReadLine(); }
static void Main(string[] args) { /// object of class operation, which contains addition and multiplication method Addition addition = new Addition(); Multiplication multiplication = new Multiplication(); /// Scan number 1 Console.Write("Enter Number 1 : "); int num1 = int.Parse(Console.ReadLine()); /// Scan number 2 Console.Write("Enter Number 2: "); int num2 = int.Parse(Console.ReadLine()); Console.WriteLine("Addition is : {0}", addition.Add(num1, num2)); Console.WriteLine("Multiplication is : {0}", multiplication.Mul(num1, num2)); /// Halt the console to wait for user input and display the result Console.WriteLine("Press any key to exit"); Console.ReadLine(); }
public void AddTest1() { Assert.AreEqual(3, Addition.Add(a.Next(1, 10))); }
public void AddTest() { Assert.AreEqual(5, Addition.Add(a.Next(1, 10), b.Next(1, 10))); }
public void AddDoubleArrayTest() { Assert.AreEqual(10.8, Addition.Add(arrayB)); }
public dynamic Add(dynamic a, dynamic b) { solution = Addition.Add(a, b); return(solution); }
public dynamic Add(dynamic values) { solution = Addition.Add(values); return(solution); }
public int Add(int x, int y) { return(Addition.Add(x, y)); }
public static string Process(string input1, string input2, string input3) { string output = string.Empty; switch (input3) { case "add": output = Addition.Add(input1, input2).ToString(); break; case "subtraction": output = Subtraction.Sub(input1, input2).ToString(); break; case "multiplication": output = Multiplication.Mul(input1, input2).ToString(); break; case "division": output = Division.Div(input1, input2).ToString(); break; case "divby3notby6": output = Divisionbythreenotbysix.Run(input1).ToString(); break; case "armstrongornot": output = Armstrongnumber.Check(input1).ToString(); break; case "factorial": output = Factorial.Calculate(input1).ToString(); break; case "palindrome": output = PalindromeNumber.Find(input1).ToString(); break; case "reverse": output = ReverseNumber.Reverse(input1).ToString(); break; case "sumofdigits": output = Sumofdigits.Find(input1).ToString(); break; case "decimaltobinary": output = DecimaltoBinary.Converts(input1).ToString(); break; case "numberincharacter": output = NumbersInCharacters.Print(input1).ToString(); break; case "strreverse": output = StringReverse.Reverse(input1).ToString(); break; case "duplicate": output = DuplicateElement.Find(input1).ToString(); break; case "unique": output = UniqueElement.Return(input1).ToString(); break; case "strpalindrome": output = StringPalindrome.Find(input1).ToString(); break; case "length": output = StringLength.Calculate(input1).ToString(); break; case "vowels": output = NumofVowels.Print(input1).ToString(); break; case "search": output = CharacterSearching.Search(input1, input2).ToString(); break; case "count": output = WordCount.Count(input1).ToString(); break; case "date": output = DateandTime.Calculate(input1).ToString(); break; } return(output); }
public void AddArrayTest() { Assert.AreEqual(10, Addition.Add(arrayA)); }
public void AddIntDoubleTest() { Assert.AreEqual(9.5, Addition.Add(a, d)); }
public void AddTest() { Assert.AreEqual(15, Addition.Add(a, b)); }
public void CanAddTwoNumbers(int x, int y, int expected) { var result = _add.Add(x, y); Assert.That(result, Is.EqualTo(expected)); }
public void AddDoubleTest() { Assert.AreEqual(10.2, Addition.Add(c, d)); }
public int Add(int a, int b) { solution = Addition.Add(a, b); return(solution); }
public int Add(int i, int j) { return(_addition.Add(i, j)); }