title: RPN_Calculator —
Elevator Pitch
- For developers wishing to get practice creating systems using TDD
- Who are interested in starting with user stories that follow the INVEST principle
- Our RPN Calculator problem is a complete problem
- That gives users a rich enough to practice simple TDD
- Unlike other problems that take you through the process step by step
- Our Product only provides the starting point from which you are expected to begin practicing
User Stories
The following list of user stories form a [[Product Backlog]]. The are additionally sectioned by Releases, each of which is given a Theme.
Release 1 - Theme: Basic Math
Release 2 - Theme: Stack Management
Release 3 - Theme: Advanced Math
Alternative Approach
Getting Started
Here are some steps to get you started:
Project Setup
- Create a workspace in eclipse
- Make sure to have separate source folders, one called src, one called test
- Add JUnit lib to your project’s classpath
TDD
- Pick the highest listed user uncompleted user story
- Create a test for the first uncompleted UAT
- Get the test to compile
- Get the test to run
- Refactor if necessary
- Check in your source code
- Repeat until all UAT’s are done for the current user story
- Repeat until all user stories for the current release are finished
Release 1
Addition
title: RPN_Calculator_Addition — As a user, I want to be able to add two numbers so that I don’t have to do the work manually
UAT
- [] 8
<enter>5<plus>-> [13] - [] 8
<enter><plus>-> [8] - [] 8
<plus>-> [8] - [] -3
<enter>7<plus>-> [4] - [4, 5, 3]
<plus>-> [4, 8]-> [12] -> [12]
Subtraction
title: RPN_Calculator_Subtraction — As a user, I want to be able to subtract two numbers so that I don’t have to do the work manually
UAT
- [] 8
<enter>5<minus>-> [3] - [] -3
<enter>-9<minus>-> [6] - [] 4.2
<enter>2.3<minus>-> [1.9] - [] 3
<minus>-> [-3] - []
<minus>-> [0]
Multiplication
title: RPN_Calculator_Multiplication — As a user, I want to be able to multiple two numbers so that I don’t have to do the work manually
UAT
- [] 8
<enter>5<times>-> [40] - [] 8
<enter><times>-> [0] - [] -4
<enter>2<times>-> [-8] - [] .5
<enter>10<times>-> [5] - [] -7
<enter>-1<times>-> [7]
Division
title: RPN_Calculator_Division — As a user, I want to be able to divide two numbers so that I don’t have to do the work manually
UAT
- [] 4
<enter>2<divide>-> [2] - [] 3
<enter>2<divide>-> [1.5] - [] -4
<enter>-8<divide>-> [.5] - [] 0
<enter>5<divide>-> [0] - [] 4
<enter>0<divide>-> division by zero error
Release 2
Review Stack
title: RPN_Calculator_Review_Stack — As a user I want to be able to review the contents of the stack so that I can confirm my numbers.
UAT
- [] 3
<enter>4<enter><display>-> [3, 4] - []
<display>-> [] - [] 6
<display>[6]
Clear Stack
title: RPN_Calculator_Clear_Stack — As a user I want to be able to clear all values on the stack so that I can start from scratch whenever I want.
UAT
- []
--> [] - [5, 4, 3]
--> []
Insert into Stack
title: RPN_Calculator_Insert_into_Stack — As a user I want to be able to insert a new number after an existing number on the stack so that I can add something in I forgot.
UAT
- [6, 4, 19, 6, 8] 3
<enter>311<insert>-> [6, 4, 311, 19, 6, 8] - [41] 1
<enter>19<insert>-> [19, 41] - [] 4
<enter>19<insert>–> []/error
Replace Item on Stack
title: RPN_Calculator_Replace_Item_on_Stack — As a user I wan to be able to replace one entry on the stack with another so that I can fix a typing error.
UAT
- [33, 2, 9] 1
<enter>777<replace>-> [33, 2, 777] - [] 2
<enter>6<replace>-> index error
Release 3
Square Root
title: RPN_Calculator_Square_Root — As a user I want to be able to take the square root of a number so that I don’t have to calculate it manually.
UAT
- [4]
-> [2] - [-4]
-> error invalid number/[] (if you want to experiment with imaginary numbers, feel free to do so)
Y to X
title: RPN_Calculator_Y_to_X — As a user I want to be able to raise one number to the power of another number so that I don’t have to calculate this manually.
UAT
- [] 6
<enter>3<YtoX>-> [216] - [] -6
<enter>2<YtoX>-> [36] - [] -6
<enter>3<YtoX>-> [-216]
1 over X
title: RPN_Calculator_1_over_X — As a user I want to be able to take a 1 over a number so that if I happen to divide in the wrong direction I can reverse the results to fix it rather than recalculating the division.
UAT
- [] 10
<enter> <1overX>-> [.1] - [] .2
<enter> <1overX>-> [5] - [] -5
<enter> <1overX>-> [-.2]
Sin
title: RPN_Calculator_Sin — As a user I want to be able to calculate the sin of an angle in degrees so that I don’t have to perform the calculation manually.
UAT
- [0]
-> [0] - [45]
-> [.7071] - [90]
-> [1] - [180]
-> [0] - [270]
-> [-1]
Cos
title: RPN_Calculator_Cos — As a user I want to be able to calculate the cos of an angle in degrees so that I don’t have to perform the calculation manually.
UAT
- [0]
-> [1] - [45]
-> [.7071] - [90]
-> [0] - [180]
-> [-1] - [270]
-> [0]
Tan
title: RPN_Calculator_Tan — As a user I want to be able to calculate the tan of an angle in degrees so that I don’t have to perform the calculation manually.
UAT
- [0]
-> [0] - [45]
-> [1] - [90]
-> error/[] - [180]
-> [0] - [270]
-> error/[]
Exponentials
title: RPN_Calculator_Exponentials — As a user I can use exponential notation to enter large numbers so I do not have to enter large numbers and possibly make a mistake.
UAT
- [] 2
<e>3<enter>-> [2000] - []
<e>6<enter>-> [1000000] - [] 1.2
<e>4<enter>-> [12000] - [] -4
<e>5<enter>-> [-400000] - [] 20
<e>-1<enter>-> [2]
Factorials
title: RPN_Calculator_Factorials — As a user I can calculate factorials (x!) for whole numbers.
UAT
- [] 3
<enter><fac>-> [6] - [2]
<fac>-> [2] - [8]
<fac>-> [40320]

Comments