using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Shapes; namespace Lab { /// /// Interaction logic for ClassMultiplyWindow.xaml /// public partial class ClassMultiplyWindow : Window { private void ClickBack(object sender, RoutedEventArgs e) => Close(); private void ClickMul(object sender, RoutedEventArgs e) { ClassOutText.Text = ""; if (!Parsers.TryParseDouble(FirstBox.Text, out var first)) { ClassOutText.Text = "first должен быть числом."; return; } if (!Parsers.TryParseDouble(SecondBox.Text, out var second)) { ClassOutText.Text = "second должен быть числом."; return; } if (second < 0 || second >= 1) { ClassOutText.Text = "second должен быть в диапазоне [0; 1)."; return; } if (!Parsers.TryParseDouble(KBox.Text, out var k)) { ClassOutText.Text = "k должен быть числом."; return; } var num = new SplitNumber(); num.Value = first + second; double val = num.Value; first = num.first; second = num.second; num.Multiply(k); ClassOutText.Text = $"Исходное число: {val} (first={first}, second={second})\n" + $"Множитель k = {k}\n" + $"Результат: {num.Value} (first={num.first}, second={num.second})"; } public ClassMultiplyWindow() { InitializeComponent(); } } }