DEV Community

Nimish Bordiya
Nimish Bordiya

Posted on

πŸ“± Simple Calculator App – SDLC Stages

1. Requirement Analysis

Objective: Build a simple calculator mobile/desktop app that can perform basic arithmetic operations.

Functional Requirements:

  1. User should be able to input two numbers.
  2. App should support basic operations: addition (+), subtraction (βˆ’), multiplication (Γ—), division (Γ·).
  3. Display the result on the screen. 4.Provide a "Clear" button to reset inputs and result.

Non-Functional Requirements:

  1. Easy-to-use interface.
  2. Fast response (instant calculations).
  3. Should not crash for invalid inputs (e.g., division by zero).

2. Design
Wireframe / Sketch (simple UI idea):

 --------------------------
|   Simple Calculator      |
|--------------------------|
|  [  Input 1  ]           |
|  [  Input 2  ]           |
|                          |
|  [+]  [-]  [Γ—]  [Γ·]      |
|                          |
|  Result: [      ]        |
|                          |
|  [ Clear ]               |
 --------------------------

Enter fullscreen mode Exit fullscreen mode
  • Two input boxes for numbers.
  • Four buttons for operations.
  • A result box to show the answer.
  • A "Clear" button.

3. Development (Pseudocode)

// Start Calculator App

BEGIN

DISPLAY "Enter first number:"
READ num1

DISPLAY "Enter second number:"
READ num2

DISPLAY "Choose operation: +, -, *, /"
READ op

IF op == "+"
    result = num1 + num2
ELSE IF op == "-"
    result = num1 - num2
ELSE IF op == "*"
    result = num1 * num2
ELSE IF op == "/"
    IF num2 == 0
        DISPLAY "Error: Division by zero not allowed"
    ELSE
        result = num1 / num2
    ENDIF
ENDIF

DISPLAY "Result = " + result

// Clear function resets num1, num2, and result

END

Enter fullscreen mode Exit fullscreen mode

4. Testing Plan

Test Cases:

| Test Case ID | Input 1 | Input 2 | Operation | Expected Output         | Notes             |
| ------------ | ------- | ------- | --------- | ----------------------- | ----------------- |
| TC01         | 5       | 3       | +         | 8                       | Basic addition    |
| TC02         | 10      | 4       | -         | 6                       | Subtraction       |
| TC03         | 6       | 7       | *         | 42                      | Multiplication    |
| TC04         | 20      | 5       | /         | 4                       | Division          |
| TC05         | 8       | 0       | /         | Error: Division by zero | Edge case         |
| TC06         | A       | 2       | +         | Error: Invalid input    | Non-numeric input |
| TC07         | 100     | 200     | -         | -100                    | Large numbers     |
Enter fullscreen mode Exit fullscreen mode

Testing Types:

  • Unit Testing: Verify each function (add, subtract, multiply, divide).
  • Integration Testing: Check interaction between UI and logic.
  • System Testing: Ensure the entire app works smoothly.
  • User Acceptance Testing (UAT): Ask real users to try for ease of use.

Top comments (0)