Using System; namespace
Download 94.71 Kb.
|
variant23
Variant № 23 . 1. Berilgan S satrdagi “a” xarfi qatnashmagan so’zlar sonini qaytaruvchi ASizSuzlarSoni(S) metodini yarating. Delegat yordamida metoddan foydalanib matndagi “a” xarfi qatnashmagan so’zlar sonini chiqaruvchi dastur tuzing. 2. Viloyat nomli (ID, Nomi, Maydoni, ShaharSoni, TumanSoni maydonlarga ega) class yarating. 6 ta viloyatdan iborat ro’yxat tuzing. Ro’yxatni TumanSoni bo’yicha saralab chiqaruvchi dastur tuzing. Title="Topshiriq2" WindowStartupLocation="CenterScreen" Height="419" Width="723"> AutoGenerateColumns="True" ItemsSource="{Binding Viloyatlar}" Width="600" FontSize="20" /> Natija: 3. WPF da uchlarining koordinatalaridan foydalanib uchburchak yuzini hisoblovchi dastur tuzing. using System; namespace Topshiriq3 { public class Uchburchak { public Nuqta BirinchiUchi { get; set; } public Nuqta IkkinchiUchi { get; set;} public Nuqta UchinchiUchi { get; set;} public double BirinchiTomoni() { double x = Math.Abs(IkkinchiUchi.X - UchinchiUchi.X); double y = Math.Abs(IkkinchiUchi.Y - UchinchiUchi.Y); return Math.Sqrt(x*x + y*y); } public double IkkinchiTomoni() { double x = Math.Abs(BirinchiUchi.X - UchinchiUchi.X); double y = Math.Abs(BirinchiUchi.Y - UchinchiUchi.Y); return Math.Sqrt(x * x + y * y); } public double UchinchiTomoni() { double x = Math.Abs(IkkinchiUchi.X - BirinchiUchi.X); double y = Math.Abs(IkkinchiUchi.Y - BirinchiUchi.Y); return Math.Sqrt(x * x + y * y); } public double Perimetri() { return BirinchiTomoni() + IkkinchiTomoni() + UchinchiTomoni(); } public double Yuzi() { double yarimPerimetr = Perimetri() / 2; //Geron formulasi double yuzi = Math.Sqrt(yarimPerimetr * (yarimPerimetr - BirinchiTomoni()) * (yarimPerimetr - IkkinchiTomoni()) * (yarimPerimetr - UchinchiTomoni())); return yuzi; } } public class Nuqta { public Nuqta(double x, double y) { X = x; Y = y; } public double X { get; set; } public double Y { get; set; } } } xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Topshiriq3" Height="600" Width="800" > HorizontalAlignment="Center" Margin="0 20"> Uchburchakning uchi koordinatalarini kiriting: Margin="0 10" HorizontalAlignment="Center"> Margin="10 0">x1: Margin="10 0">y1: Margin="0 10" HorizontalAlignment="Center"> Margin="10 0">x2: Margin="10 0">y2: Margin="0 10" HorizontalAlignment="Center"> Margin="10 0">x3: Margin="10 0">y3: Height="40" Margin="10" x:Name="btn" Click="Btn_Click">Hisoblash Margin="0 10" HorizontalAlignment="Center"> Margin="10 0">Uchburchakning yuzi: Download 94.71 Kb. Do'stlaringiz bilan baham: |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling