init
This commit is contained in:
commit
08d40b6241
3 changed files with 33 additions and 0 deletions
23
01/Eins.java
Normal file
23
01/Eins.java
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
public class Eins {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
System.out.println(calculateScore("imperative") == 9);
|
||||||
|
System.out.println(calculateScore("no") == 2);
|
||||||
|
System.out.println(wordScore("declarative") == 9);
|
||||||
|
System.out.println(wordScore("yes") == 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int calculateScore(String word) {
|
||||||
|
int score = 0;
|
||||||
|
for (char c : word.toCharArray()) {
|
||||||
|
if (c != 'a') {
|
||||||
|
score++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return score;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int wordScore(String word) {
|
||||||
|
return word.replace("a", "").length();
|
||||||
|
}
|
||||||
|
}
|
||||||
10
01/ShoppingCart.java
Normal file
10
01/ShoppingCart.java
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class ShoppingCart {
|
||||||
|
|
||||||
|
private List<String> items = new ArrayList<String>();
|
||||||
|
private boolean bookAdded;
|
||||||
|
|
||||||
|
public static void main(String[] args) {}
|
||||||
|
}
|
||||||
BIN
bin/Main.class
Normal file
BIN
bin/Main.class
Normal file
Binary file not shown.
Loading…
Reference in a new issue