0% found this document useful (0 votes)
27 views3 pages

SPOS Assignment 5: Mohit Gandhi TECOC316

This document provides code for creating a DLL file that performs mathematical operations and an application to test it. The DLL file contains a Functions class with methods for addition, subtraction, multiplication and division. The application code defines a MainWindow class that initializes the Functions class, gets user input from textboxes, calls the DLL methods and displays the results.

Uploaded by

Mohit Gandhi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views3 pages

SPOS Assignment 5: Mohit Gandhi TECOC316

This document provides code for creating a DLL file that performs mathematical operations and an application to test it. The DLL file contains a Functions class with methods for addition, subtraction, multiplication and division. The application code defines a MainWindow class that initializes the Functions class, gets user input from textboxes, calls the DLL methods and displays the results.

Uploaded by

Mohit Gandhi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

SPOS Assignment 5

Mohit Gandhi TECOC316

Assignment Title: Create DLL file for any mathematical operation and write an application
program to test it. download below file for instructions.

Output:
Source code for calculator.cs
namespace Calculator
{
public class Functions
{
public double add(double a,double b)
{
return a + b;
}
public double sub(double a, double b)
{
return a - b;
}
public double mul(double a, double b)
{
return a * b;
}
public double div(double a, double b)
{
return a / b;
}

}
}

Source code for Mainwindow.xaml.vb


Class MainWindow
Dim func As New Calculator.Functions
Dim a, b As String

Private Sub Button_Click_1(sender As Object, e As RoutedEventArgs)


Try
a = t1.Text
b = t2.Text

tt1.Text = "Add: " + func.add(a, b).ToString()


tt2.Text = "Sub: " + func.sub(a, b).ToString()
tt3.Text = "Mul: " + func.mul(a, b).ToString()
tt4.Text = "Div: " + func.div(a, b).ToString()

Catch
MessageBox.Show("Enter correct info")
End Try
End Sub
End Class

Source code for Mainwindow.xaml


<Window x:Class="MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfApp1"
mc:Ignorable="d"
Title="Simple Calculator" Height="500" Width="300">
<Grid Margin="0,0,0,1">
<TextBox x:Name="t1" HorizontalAlignment="Center" Margin="0,69,0,0" Text="0"
TextWrapping="Wrap" VerticalAlignment="Top" Width="176" Height="32"/>
<TextBox x:Name="t2" HorizontalAlignment="Center" Margin="0,127,0,0" Text="0"
TextWrapping="Wrap" VerticalAlignment="Top" Width="176" Height="34"/>
<Button Content="Calculate" HorizontalAlignment="Center" Margin="0,198,0,0"
VerticalAlignment="Top" Height="36" Width="120" Click="Button_Click_1"/>
<Label Content="Answer" HorizontalAlignment="Left" Margin="62,269,0,0"
VerticalAlignment="Top"/>
<TextBlock x:Name="tt1" HorizontalAlignment="Left" Margin="62,312,0,0" Text=""
TextWrapping="Wrap" VerticalAlignment="Top" Height="23" Width="158"/>
<TextBlock x:Name="tt2" HorizontalAlignment="Left" Margin="62,347,0,0" Text=""
TextWrapping="Wrap" VerticalAlignment="Top" Height="23" Width="158"/>
<TextBlock x:Name="tt3" HorizontalAlignment="Left" Margin="62,375,0,0" Text=""
TextWrapping="Wrap" VerticalAlignment="Top" Height="23" Width="158"/>
<TextBlock x:Name="tt4" HorizontalAlignment="Left" Margin="62,409,0,0" Text=""
TextWrapping="Wrap" VerticalAlignment="Top" Height="23" Width="158"/>
</Grid>
</Window>

You might also like