Overview
In this tutorial, we will create a Calculator RAPTOR Flowchart. We will create sub-modules for different arithmetic operations performed by the calculator.
IPO chart
Consider modeling an IPO chart for the flowchart before the flowchart design. Think about the input to the flowchart, processing statements, and the output of the flowchart. IPO chart is a handy tool to visualize in a tabular format.
Input | Process | Output |
Input to the flowchart. | Computations that are done in the flowchart. | Output displayed by the flowchart |
Calculator Flowchart
The flowchart menu for the user to select the calculator operation.
Calculator Flowchart
1.Add
2.Subtract
3.Multiply
4.Divide
Add Sub flowchart
The Add , Subtract, Multiply and Divide are sub modules in the flowchart. We call the respective modules based on the user choice.
Add sub flowchart.
Divide sub flowchart
Pseudocode:
Public Sub Main() Dim result Dim num1 Dim choice Dim num2 clear_console MsgBox "Calculator Flowchart" MsgBox "1.Add" MsgBox "2.Subtract" MsgBox "3.Multiply" MsgBox "4.Divide" Prompt = "Enter your choice:" Input choice If choice > 0 And choice < 5 Then If choice = 1 Then Prompt = "Enter number1" Input num1 Prompt = "Enter number2" Input num2 result = num1 + num2 MsgBox "Result " + num1 + " + " + num2 + " =" + result Else If choice = 2 Then Prompt = "Enter number1" Input num1 Prompt = "Enter number2" Input num2 result = num1 - num2 MsgBox "Result " + num1 + " - " + num2 + " =" + result Else If choice = 3 Then Prompt = "Enter number1" Input num1 Prompt = "Enter number2" Input num2 result = num1 * num2 MsgBox "Result " + num1 + " * " + num2 + " =" + result Else Prompt = "Enter number1" Input num1 Prompt = "Enter number2" Input num2 If num2 = 0 Then MsgBox "DIVIDE BY ZERO ERROR" Else result = num1 / num2 MsgBox "Result " + num1 + "/ " + num2 + " =" + result End If End If End If End If Else MsgBox "INVALID OPERATION" End If End Sub
Output:
Let’s run the flowchart with sample test cases to verify that it’s working as intended. If you find that the flowchart is not working as intended in the testing, we may need to verify and debug the flowchart.
Debugging a flowchart: https://www.testingdocs.com/debugging-a-raptor-flowchart/
Calculator Flowchart
1.Add
2.Subtract
3.Multiply
4.Divide
Result 34 * 15 =510
—-Run complete. 20 symbols evaluated.—-
Raptor Tutorials on this website can be found at:
https://www.testingdocs.com/raptor-a-flowchart-tool/
RAPTOR official website: https://raptor.martincarlisle.com/