Skip to content

Commit 6b6aeb9

Browse files
committed
docs: kata description
1 parent f5c9741 commit 6b6aeb9

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

kata/8-kyu/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@
180180
- [Rock Paper Scissors!](rock-paper-scissors "5672a98bdbdd995fad00000f")
181181
- [Sentence Smash](sentence-smash "53dc23c68a0c93699800041d")
182182
- [Short Long Short](short-long-short "50654ddff44f800200000007")
183+
- [simple calculator ](simple-calculator "5810085c533d69f4980001cf")
183184
- [Simple Fun #1: Seats in Theater](simple-fun-number-1-seats-in-theater "588417e576933b0ec9000045")
184185
- [Simple multiplication](simple-multiplication "583710ccaa6717322c000105")
185186
- [Simple validation of a username with regex](simple-validation-of-a-username-with-regex "56a3f08aa9a6cc9b75000023")
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# [simple calculator ](https://www.codewars.com/kata/simple-calculator "https://www.codewars.com/kata/5810085c533d69f4980001cf")
2+
3+
You are required to create a simple calculator that returns the result of addition, subtraction, multiplication or division of two numbers.
4+
5+
Your function will accept three arguments:<br>
6+
The first and second argument should be numbers.<br>
7+
The third argument should represent a sign indicating the operation to perform on these two numbers.
8+
```if-not:csharp,java
9+
if the variables are not numbers or the sign does not belong to the list above a message "unknown value" must be returned.
10+
```
11+
```if:csharp,java
12+
If the sign is not a valid sign, throw an IllegalArgumentException (Java) or ArgumentException (C#).
13+
```
14+
15+
# Example:
16+
17+
~~~if-not:csharp,java
18+
```
19+
arguments: 1, 2, "+"
20+
should return 3
21+
22+
arguments: 1, 2, "&"
23+
should return "unknown value"
24+
25+
arguments: 1, "k", "*"
26+
should return "unknown value"
27+
```
28+
~~~
29+
~~~if:csharp,java
30+
```
31+
arguments: 1, 2, "+"
32+
should return 3
33+
34+
arguments: 1, 2, "&"
35+
should throw an IllegalArgumentException (Java) or ArgumentException (C#)
36+
```
37+
~~~
38+
39+
Good luck!

0 commit comments

Comments
 (0)