web development
Northeastern University, ITC 2811 – Advanced Application Development Assignment 2
Page 1 of 2
Assignment 2
For this assignment you are going to create a Web Forms project that has a Web Form item
called Calculator.aspx. This form should have the following controls:
3 Label controls that display “First Number:”, “Second Number”, and “Result”
3 TextBox controls that correspond to each of the above Labels respectively.
4 Buttons for addition, subtraction, multiplication, and division.
The form should look something like what is shown in the image below.
Here is how it should work:
The user simply
Enters a value for the first number
Then another value for the second number, and finally
Clicks one of the 4 buttons corresponding to the 4 main functions.
The two numbers are then added, subtracted, multiplied, or divided based on which button was pressed.
Northeastern University, ITC 2811 – Advanced Application Development Assignment 2
Page 2 of 2
Other Requirements:
Make sure that all buttons on the form are the same size. To do so, look for the Width property of each button and make sure they have the same value.
Make sure that data type conversions happen as needed. For example, before the numbers can be added or subtracted, they need to be converted from string to integer. Also, the
result needs to be converted from integer to string to be able to assign to the Text
property of the result TextBox.
Do not worry about division by zero. The assumption is that this will never happen.
Notes:
To lay two controls next to each other horizontally (rather than stacking them up vertically), do not put the <br /> tag in between them.
To add a blank space between two controls that are side by side, you can use the following HTML entity:
Example:
<asp:Button ID="Button1" runat="server" Text="+" Width="30px" /> <asp:Button ID="Button2" runat="server" Text="-" Width="30px" />