Simple Calculator

Create a simple calculator
1.For this project, you’ll create a form that accepts two

operands and an operator from the user and then performs the

requested operation.
The design of the Simple Calculator form
Operation
•The user enters two operands and an operator and clicks the

Calculate button or presses the Enter key to perform the

calculation.
•If the data is valid, the program performs the requested

operation.
•If the data is invalid, the program displays an appropriate

error message.
Specifications
•Before performing the calculation, the application should check

that both operands are numeric and that the operator is one of

the following:
+ add
– subtract
* multiply
/ divide
It should also check that both operands are between 0 and

1,000,000 (non-inclusive). To perform this data validation, code

IsPresent, IsDecimal, and IsValidData procedures as described in

chapter 7 of the book. In addition, code an IsOperator procedure

that checks for a valid operator.
•Code a private procedure named Calculate that performs the

requested operation and returns a decimal value. This procedure

should accept the following arguments

×
New Download