public void Clear_Order() { Pennies = 0; PenniesText.Text = Pennies.ToString(); Nickles = 0; NicklesText.Text = Nickles.ToString(); Dimes = 0; DimesText.Text = Dimes.ToString(); Quarters = 0; QuartersText.Text = Quarters.ToString(); HalfDollars = 0; HalfDollarsText.Text = HalfDollars.ToString(); Dollars = 0; DollarsText.Text = Dollars.ToString(); Ones = 0; OnesText.Text = Ones.ToString(); Twos = 0; TwosText.Text = Twos.ToString(); Fives = 0; FivesText.Text = Fives.ToString(); Tens = 0; TensText.Text = Tens.ToString(); Twenties = 0; TwentiesText.Text = Twenties.ToString(); Fifties = 0; FiftiesText.Text = Fifties.ToString(); Hundreds = 0; HundredsText.Text = Hundreds.ToString(); TotalBox.Text = 0.00.ToString("C"); }
public void GetQuantitativeNumber_return_not_empty_string_for_50_80(string expectedResult, int arg, SubjectiveCase subjective) { var result = Tens.GetQuantitativeNumber(arg, subjective); Assert.AreEqual(expectedResult, result); }
string ConvertNumberToWords(int val) { int num = val % 1000; if (0 == num) { return(""); } if (num < 0) { throw new ArgumentOutOfRangeException("val", "Параметр не может быть отрицательным"); } var hunds = Hunds.GetQuantitativeNumber(num, SubjectiveCaseNumber); if (!string.IsNullOrEmpty(hunds)) { hunds = hunds.AddSpace(); } StringBuilder r = new StringBuilder(hunds); if (num % 100 < 20) { r.Append(Frac20.GetQuantitativeNumber(num, x => x % 100, SubjectiveCaseNumber, NumberKind).AddSpace()); } else { r.Append(Tens.GetQuantitativeNumber(num, SubjectiveCaseNumber).AddSpace()); r.Append(Frac20.GetQuantitativeNumber(num, x => x % 10, SubjectiveCaseNumber, NumberKind).AddSpace()); } return(r.ToString()); }
public void Draw(Graphics drawer, Bitmap[] images, int number) { if (number > 99) { number = number % 100; } Tens?.Draw(drawer, images, number / 10); Ones?.Draw(drawer, images, number % 10); }
private void Tens_minus(object sender, RoutedEventArgs e) { if (Tens - 1 < 0) { return; } Tens--; TensText.Text = Tens.ToString(); TotalBox.Text = Total.ToString("C"); }
private void FillTens() { Tens.Add(2, "twenty"); Tens.Add(3, "thirty"); Tens.Add(4, "forty"); Tens.Add(5, "fifty"); Tens.Add(6, "sixty"); Tens.Add(7, "seventy"); Tens.Add(8, "eighty"); Tens.Add(9, "ninety"); }
protected string IntegerNumber(string number) { int numDigit = number.Length; int pos = 0; string place = string.Empty; StringBuilder fword = new StringBuilder(); if (number.StartsWith("-")) { fword.Append("Minus"); number = number.Substring(1); } while (number.Length > 0) { if (number.Length == 1) { fword.Append(" " + Ones.GetOnes(number)); break; } else if (number.Length == 2) { fword.Append(" " + Tens.GetTens(number)); break; } else { place = GetPlaceValue(number, out pos); } if (pos == 1) { fword.Append(" " + Ones.GetOnes(number.Substring(0, pos))); } else if (pos == 2) { fword.Append(" " + Tens.GetTens(number.Substring(0, pos))); } else { fword.Append(" " + IntegerNumber(number.Substring(0, pos))); } fword.Append(" " + place); number = number.Substring(pos); number = number.TrimStart('0'); } return(fword.ToString().Trim()); }
private void Tens_add(object sender, RoutedEventArgs e) { Tens++; TensText.Text = Tens.ToString(); TotalBox.Text = Total.ToString("C"); }