Question: Create a Windows Forms application that has the following: Define a function named IsPositive, which has one parameter as Integer. If the number in the
Create a Windows Forms application that has the following:
Define a function named IsPositive, which has one parameter as Integer. If the number in the parameter is positive (>= 0) the function returns True, otherwise it returns False.
A button showing the textFactorial. When clicked this button uses a function named Factorial passing ita number typed in a textbox named NumEntrytxt. Thencheck the return value of the Factorial function, using IsPositive. If it is positive then show the factorial value in textbox named Resulttxt. Otherwiseshow the message "Data entered has no defined factorial".
A button showing the textPrime ?.When clicked this button uses a function named IsPrimepassing ita number typed in a textbox named NumEntrytxt, then it showsthe result in a textbox named Resulttxt. If the function returns True, the result should be "X is Prime", otherwise show "X is not Prime", where X is the actual number passed to the function.
Write the function definition of Factorial, which has one integer parameter and uses the IsPositive function to check if the number passed is positive, then it returns the factorial of that number (code to calculate factorialis in the book in an earlier chapter). If the number is not positive, Factorial returns -1 (meaning there is an error).
Write thefunction definition of IsPrime, which has one integer parameter and uses the IsPositive function to check if the number passed is positive, then it returns True if the number pass is indeed a prime number, otherwise return False. Code to check if a numberis a prime number, is in the book in an earlier chapter.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
