Download Here: Source Code
<Window x:Class="Trigonometry.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid>
<TextBox Height="33" HorizontalAlignment="Left" Margin="174,90,0,0" Name="inputDisplay" VerticalAlignment="Top" Width="156" />
<Button Content="Cos (" Height="23" HorizontalAlignment="Left" Margin="174,129,0,0" Name="cosBTN" VerticalAlignment="Top" Width="75" Click="cosBTN_Click" />
<Button Content="Sin (" Height="23" HorizontalAlignment="Left" Margin="255,129,0,0" Name="sinBTN" VerticalAlignment="Top" Width="75" Click="sinBTN_Click" />
<Button Content="Tan (" HorizontalAlignment="Left" Margin="174,158,0,0" Name="tanBTN" Width="75" Height="23" VerticalAlignment="Top" Click="tanBTN_Click" />
<Button Content="Cot (" Height="23" HorizontalAlignment="Left" Margin="255,158,0,0" Name="cotBTN" VerticalAlignment="Top" Width="75" Click="cotBTN_Click" />
<Button Content="Sec (" Height="23" HorizontalAlignment="Left" Margin="255,187,0,0" Name="secBTN" VerticalAlignment="Top" Width="75" Click="secBTN_Click" />
<Button Content="Cosec (" Height="23" HorizontalAlignment="Left" Margin="174,187,0,0" Name="cosecBTN" VerticalAlignment="Top" Width="75" Click="cosecBTN_Click" />
<Label Content="* Angle must be in radian" Foreground="Red" Height="28" HorizontalAlignment="Left" Margin="174,56,0,0" Name="label1" VerticalAlignment="Top" Width="156" />
</Grid>
</Window>
namespace Trigonometry
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void cosBTN_Click(object sender, RoutedEventArgs e)
{
MessageBox.Show( "Cos("+inputDisplay.Text+") = "+Math.Cos(double.Parse(inputDisplay.Text)).ToString());
}
private void sinBTN_Click(object sender, RoutedEventArgs e)
{
MessageBox.Show("Sin(" + inputDisplay.Text + ") = " + Math.Sin(double.Parse(inputDisplay.Text)).ToString());
}
private void tanBTN_Click(object sender, RoutedEventArgs e)
{
MessageBox.Show("Tan(" + inputDisplay.Text + ") = " + Math.Tan(double.Parse(inputDisplay.Text)).ToString());
}
private void cotBTN_Click(object sender, RoutedEventArgs e)
{
double cot = 1/(Math.Tan(double.Parse(inputDisplay.Text)));
MessageBox.Show("Cos(" + inputDisplay.Text + ") = " + cot.ToString());
}
private void cosecBTN_Click(object sender, RoutedEventArgs e)
{
double cosec = 1 / (Math.Sin(double.Parse(inputDisplay.Text)));
MessageBox.Show("Cosec(" + inputDisplay.Text + ") = " + cosec.ToString());
}
private void secBTN_Click(object sender, RoutedEventArgs e)
{
double sec = 1 / (Math.Cos(double.Parse(inputDisplay.Text)));
MessageBox.Show("Sec(" + inputDisplay.Text + ") = " + sec.ToString());
}
}
}
No comments:
Post a Comment