asp net again

profilesanosh3
assignment_5.pdf

Northeastern University, ITC 2811 – Advanced Application Development Assignment 5

Page 1 of 2

Assignment 5

For this assignment, you are going to create a Web Forms project called Assignment 5 as follows:

 In the Models folder of the project, create a class called Operations that has the following members:

o A private integer field called userInput. o A public property called UserInput that gets and sets the value of userInput. o A public method called Factorial that

 Returns an integer.  Has no parameters.  Calculates the factorial of userInput.  Returns the calculated factorial.

o A public method called Sum that  Returns an integer.  Has no parameters.  Calculates the sum of integers from 1 to userInput using any looping

structure of your choosing.

 Returns the calculated sum.

 Add a Web Form called Demo.aspx to the project that has o A TextBox control with ID of inputTxt. o A Button control with ID of factorial and Text property of Calculate Factorial! o Another Button control with ID of sum and Text property of Calculate Sum! o A Label control with ID of result and Text property of empty string ("")

 Create a click event handler method for the factorial Button. The code in the handler should

o Create an object of type Operations o Assign the value entered by the user in the inputTxt TextBox control to the

object’s UserInput property.

o Call the object’s Factorial method and assign the resulting value returned by the method to the Text property of the result Label

 Create a click event handler method for the sum Button. The code in the handler should o Create an object of type Operations o Assign the value entered by the user in the inputTxt TextBox control to the

object’s UserInput property.

o Call the object’s Sum method and assign the resulting value returned by the method to the Text property of the result Label

Northeastern University, ITC 2811 – Advanced Application Development Assignment 5

Page 2 of 2

How it should Work

When Demo.aspx is loaded in the browser, the user enters a number in the text box and clicks

either the Calculate Factorial! button or the Calculate Sum! button. If the former is clicked, the

factorial of the number is shown in the result label and if the latter is clicked, the sum of numbers

from 1 to the input number is displayed in the result label. Please make sure to use a small

integer less than or equal to 20 when testing your work.

What to Submit

To submit this assignment, you may zip up the solution folder(s) and submit them to me via the

Blackboard.

Good luck and don’t hesitate to contact me if you have any question