Using System; namespace


Download 94.71 Kb.
Sana29.03.2023
Hajmi94.71 Kb.
#1305796
Bog'liq
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.

x:Class="Topshiriq2.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Topshiriq2"
WindowStartupLocation="CenterScreen"
Height="419"
Width="723">

x:Name="viloyatlarGrid"
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="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Topshiriq3" Height="600" Width="800"
>


Width="600"
Margin="0 10"
HorizontalAlignment="Center">






Width="600"
Margin="0 10"
HorizontalAlignment="Center">






Width="600"
Margin="0 10"
HorizontalAlignment="Center">








Width="600"
Margin="0 10"
HorizontalAlignment="Center">








Download 94.71 Kb.

Do'stlaringiz bilan baham:




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling