Program specifications (business requirements): Calculator
Create a Windows application that performs the basic
operations of a calculator. The calculator should perform the following
functionality (addition, subtraction, multiplication, division, square root of
a number and raise power of a number).
Remember to think
about the programming process when developing your solution:
·
INPUT
·
PROCESS/LOGIC/COMPUTATION/ALGORITHM
·
OUTPUT
Program
specification constraints (requirements):
·
When the application is first launched, the
results screen should display the default value of 0.
·
The +, -, X, / buttons when clicked should
perform the appropriate arithmetic operation after two validate input numbers
are entered by the user.
·
The application should validate all user input
for blank, null or invalid data before a calculation is performed.
·
The form’s Exit Button should close the
application.
·
The Clear Button should clear the UI interface
and display the default 0 value.
·
The two Future Func buttons should display a message
box with the appropriate messages. See design constraints below.
Design constraint:
·
Application should display the following in the
form’s title. <<Your lastname - Calculator>>
·
The expression and label controls should use the
Microsoft Sans Serif Font, Font Style Regular and Font Size 22.
·
The = (Equals) button should perform the
appropriate calculation based on the user’s selection to display the expression
in the expression label (top) and the calculation in the results label (bottom
label).
·
Application should validate and prevent all
blank or null input by the user. Otherwise an error message should be displayed
in a message box with the appropriate format. (See screen shot exhibit D)
·
Application should validate both set of numbers
have been entered. Otherwise an error message should be displayed in a message
box with the appropriate format. (See screen shot exhibit E)
·
Application must use Exception handling around
all critical functions (users and computation errors) including but not limited
to just the DoCalculate method. Application should display all errors in the
same type of message box format as seen in screen shot exhibit D/E.
·
Application must use the appropriate .NET
namespace for the raise power and square root calculations. **You need to determine what namespace to
use and how to use it. ***
·
Program needs to create the following 9 private methods with the exact names
below in the Calculator Form class along with the required design specifications:
o
DoCalculate
– This method should be called from the Calculate Button Click Event after all
validation has passed. The parameters to this method should be the two user values
from the UI. The DoCalcuate method should contain logic to determine which operation
has been selected and call the appropriate operation methods listed below. The DoCalculate method should return the
computed value of the requested operations (methods) below to the calling
program in the results label field on the UI.
AddValues
DivideValues
SubtractValues
MultiplyValues
SquareRootValues
RaisePowerValues
o
ClearForm
– This method clears all the UI text boxes, reset any internal hold variables
that you have defined and enters a 0 in the result label. This method should be
called from the C (Clear) button click event.
o
**New** -
FutureFeatureNotAvailable – This method should be called by the two Future
Features buttons. The method is defined as a void return type and accepts a
string parameter for the specific message to be displayed in the message box
for each future feature calculator button event. The message box should include
a caption that states your last name - Calculator, custom message, OK button
and Information icon. See screenshots exhibit B and C.
§
Future Feature 1 button should pass in the
string value of “Future Function 1 is not Available for this version.”
§
Future Feature 2 button should pass in the
string value of “Future Function 2 is not Available for this version.”
o
AddValues
– This method accepts two double type parameters and adds the two values
together. The method returns the computed value as a string back to the calling
procedure. Inside the AddValues procedure, set the text of the Expression label
to display “ {parameter value one} + {parameter
value two}“. For example “5 + 5”.
o
DivideValues
– This method accepts two double type parameters and divides the two values.
The method returns the computed value as a string back to the calling
procedure. Inside the DivideValues procedure, set the text of the Expression
label to display “ {parameter value one} /
{parameter value two}“. For example “5 / 5”.
o
SubtractValues
– This method accepts two double type parameters and subtracts the two values. . The method returns the computed value as a
string back to the calling procedure. Inside the SubtractValues procedure, set
the text of the Expression label to display “ {parameter value one} - {parameter value two}“. For example “5 - 5”.
o
MultiplyValues
- This method accepts two double type parameters and multiplies the two
values. . The method returns the
computed value as a string back to the calling procedure. Inside MultiplyValues
procedure, set the text of the Expression label to display “ {parameter value
one} * {parameter value two}“. For
example “5 * 5”.
o
SquareRootValues
- This method accepts the one double type parameter and computes the square
root of the value. The method returns the computed value as a string back to the
calling procedure. Inside the SquareRootValues procedure, set the text of the
Expression label to display “ The Square Root of {parameter value one} “. For
example “The Square Root of 5”.
o
RaisePowerValues
- This method accepts two double type parameters and computes the raise
power value. The method returns the computed value as a string back to the
calling procedure. Inside the RaisePowerValues procedure, set the text of the
Expression label to display “ {parameter one value} is raised to the {parameter
two value} “. For example “3 raised to the 4 power”.
Always add documentation in the beginning of your program
using the //Enter your comments. See example below.
//Your name: Enter your name
//Description: Briefly describe what the program does
//Date Created: Enter the date when the program was created
Get Free Quote!
440 Experts Online