Skip to content
Snippets Groups Projects
Commit 8d69f4df authored by Sami Kesäjärvi's avatar Sami Kesäjärvi
Browse files

calculator siirretty ja testi luotu

parent 46a3e9c8
No related branches found
No related tags found
No related merge requests found
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
<mapping directory="$PROJECT_DIR$/calculator" vcs="Git" />
</component>
</project>
\ No newline at end of file
class Calculator {
private int result;
public Calculator() {
reset();
}
public void reset() {
this.result = 0;
}
public int getResult() {
return this.result;
}
public void add(int value) {
this.result += value;
}
public void subtract(int value) {
this.result += value;
}
public void multiply(int value) {
for (int i=1; i<value; i++) {
add(value);
}
}
public void exponent(int value) {
for(int i=1; i<value; i++) {
multiply(value);
}
}
}
\ No newline at end of file
import static org.junit.jupiter.api.Assertions.*;
class CalculatorTest {
@org.junit.jupiter.api.Test
void reset() {
}
@org.junit.jupiter.api.Test
void getResult() {
}
@org.junit.jupiter.api.Test
void add() {
}
@org.junit.jupiter.api.Test
void subtract() {
}
@org.junit.jupiter.api.Test
void multiply() {
}
@org.junit.jupiter.api.Test
void exponent() {
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment