Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 16e7583

Browse files
Kyu 8 | A + B
1 parent 78cba14 commit 16e7583

File tree

4 files changed

+29
-0
lines changed

4 files changed

+29
-0
lines changed

‎src/main/java/kyu8/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ Kata Found realized
1010

1111
- [8kyu interpreters: HQ9+](kyu8InterpretersHQ9)
1212

13+
- [A + B](A+B)
14+
1315
- [Find Nearest square number](findNearestSquareNumber)
1416

1517

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package kyu8.aSumB;
2+
3+
public class FirstClass {
4+
public static byte sum(byte a, byte b) {
5+
byte c = (byte) (a + b);
6+
return c;
7+
}
8+
}

‎src/main/java/kyu8/aSumB/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# A + B
2+
3+
Vasya Pupkin just started learning Java and C#. At first, he decided to write simple program that was supposed to sum up
4+
two small numbers (numbers and their sum fit in a byte), but it didn't work. Vasya was too sad to find out what is
5+
wrong. Help him to correct the mistake.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package kyu8.aSumB;
2+
3+
import org.junit.jupiter.api.Test;
4+
5+
import static org.junit.jupiter.api.Assertions.assertEquals;
6+
7+
public class testFirstClass {
8+
@Test
9+
public void testSum() throws Exception {
10+
byte a = 1;
11+
byte b = 2;
12+
assertEquals(3, FirstClass.sum(a, b));
13+
}
14+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /