This commit is contained in:
cediackermann 2026-04-21 11:17:54 +02:00
commit 08d40b6241
3 changed files with 33 additions and 0 deletions

23
01/Eins.java Normal file
View 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
View 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

Binary file not shown.