Skip to content

Commit 8ba1d66

Browse files
Web 0.14.22: Text-Fallnamen in Anführungszeichen (#251)
* Lektion 10: Fallnamen für Texte in Anführungszeichen ("rot", "+") Ampel- und Rechner-Diagramme (de/en/pt) nutzen jetzt "rot"/"gelb"/"grün" bzw. "+"/"-"/"*" als Fallnamen; Texte und Wissenstest angepasst. Erzeugter Java-Code ist damit gültig (case "rot" statt case rot). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ugz28VVaHVrA1RLEesxdrh * Web 0.14.22: Text-Fallnamen in Anführungszeichen Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ugz28VVaHVrA1RLEesxdrh --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 8062495 commit 8ba1d66

18 files changed

Lines changed: 85 additions & 84 deletions

‎CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ The format is loosely inspired by Keep a Changelog.
88

99
### Changed
1010

11+
- **Web 0.14.22, text case names in quotation marks:** in lesson 10 the traffic light structure chart now uses the case names `"rot"`, `"gelb"`, `"grün"` (en `"red"` …, pt `"vermelho"` …) and the calculator solution `"+"`, `"-"`, `"*"`, so it is clear they are texts and the generated Java (`case "rot" ->`) is valid. Lesson text, hint and quiz say so (de/en/pt). The simulation still accepts case names without quotes.
1112
- **Web 0.14.21, array output like in Java:** `System.out.println(zahlen)` now prints a reference such as `[I@1e3779b1` in Simulation and Programmieren, as real Java does (`[D@`, `[Z@`, `[Ljava.lang.String;@`, `[[I@`; the same array keeps its id). `Arrays.toString(…)` and `Arrays.deepToString(…)` show the content; `Arrays` needs `import java.util.Arrays;` like javac, and the Java export adds it. The variable table still shows the content. Lesson 15 „Jetzt in Java“ explains reference and `Arrays.toString` (de/en/pt).
1213
- **Web 0.14.18, upper and lower case, exercises „Warum läuft das nicht?“:** lesson 4 gets the new step „Groß- und Kleinschreibung“ (case-sensitive: `zahl`, `Zahl` and `ZAHL` are three names) with a structure chart exercise (`zahl` and `Zahl` both declared, `ZAHL` used), a Kompetenz item and a quiz question; glossary entry case-sensitive. Lessons 4–17 and 19 each get a Java exercise „Warum läuft das nicht?“: the start code doesn't run (misspelled variable such as `Alter`/`Grenze`/`properson`, variable used before it is created or never created, `system.out`, `.Length`, `charat`), the student reads the error message, fixes it and clicks Check (de/en/pt). The Code area now reports wrong case in Java words (`system.out.println`, `System.Out`, `Println`, `math.sqrt`, `text.Length()`, `name.charat(0)`) with the right spelling, blocks Run like javac and offers the 💡 fix; the simulation says „Unbekannte Variable: Zahl. Java unterscheidet Groß- und Kleinschreibung: Meintest du zahl?“ when the name exists in another case (all 21 languages).
1314
- **Web 0.14.17, hint on a missing line break:** when a Java exercise's output is right except that lines run together (e.g. `System.out.print` twice instead of `println`), the check now says „Fast! Es fehlt nur ein Zeilenumbruch …“ and explains print vs. println, instead of only showing a mismatch. `\n` inside an output now starts a new line, so `System.out.print("…\n")` counts like `println` (de/en/pt; all exercises).

‎web/lessons/de/10-fallauswahl.md‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ Derselbe Automat als Fallauswahl. Hat wahl den Wert 2, wird nur die Spalte 2 aus
3939
4040
## Fälle mit Texten
4141

42-
Die Fälle müssen keine Zahlen sein. Du kannst auch nach dem Inhalt einer `String`-Variablen auswählen. Als Fallname schreibst du dann den Text, zum Beispiel `rot`.
42+
Die Fälle müssen keine Zahlen sein. Du kannst auch nach dem Inhalt einer `String`-Variablen auswählen. Als Fallname schreibst du dann den Text in Anführungszeichen, zum Beispiel `"rot"`. So erkennt man wie im Code, dass es ein Text ist.
4343

4444
::: diagramm l09-ampel.visustruct
4545
Eine Ampel: Je nach eingegebener Farbe erscheint ein anderer Hinweis. Probiere in der Simulation auch eine Farbe aus, die es nicht gibt.
4646
:::
4747

48-
Groß- und Kleinschreibung zählt: `Rot` passt nicht zum Fall `rot`.
48+
Groß- und Kleinschreibung zählt: `Rot` passt nicht zum Fall `"rot"`.
4949

5050
## Übung: Note in Worten
5151

@@ -75,7 +75,7 @@ test: 6, *, 7 -> 42
7575
test: 1, x, 2 -> Unbekanntes Rechenzeichen
7676
braucht: fallauswahl
7777
tipp: Lies erst alle drei Werte ein. Danach entscheidet eine Fallauswahl über das Rechenzeichen, was gerechnet wird.
78-
tipp: Lege vor der Fallauswahl `int ergebnis = 0` an. In jedem Fall rechnest du zum Beispiel `ergebnis = a + b` und gibst danach `ergebnis` aus. Die Fallnamen sind einfach `+`, `-` und `*`.
78+
tipp: Lege vor der Fallauswahl `int ergebnis = 0` an. In jedem Fall rechnest du zum Beispiel `ergebnis = a + b` und gibst danach `ergebnis` aus. Die Fallnamen sind `"+"`, `"-"` und `"*"` in Anführungszeichen, weil das Rechenzeichen ein `String` ist.
7979
lösung: l09-rechner-loesung.visustruct
8080
:::
8181

@@ -307,9 +307,9 @@ Schätze dich bei jedem Punkt ehrlich ein: ☂️ noch nicht, ⛅ teilweise, ☀
307307
- [ ] Eine Farbe wie rot, gelb oder grün auswerten
308308
> „Über 30“ ist ein Bereich. Dafür brauchst du eine Verzweigung mit einem Vergleich.
309309
310-
? Du gibst bei der Ampel `Rot` ein, der Fall heißt `rot`. Was passiert?
310+
? Du gibst bei der Ampel `Rot` ein, der Fall heißt `"rot"`. Was passiert?
311311
→ So ist die Fallauswahl aufgebaut
312-
- [ ] Der Fall rot wird ausgeführt.
312+
- [ ] Der Fall `"rot"` wird ausgeführt.
313313
- [x] Der Fall default wird ausgeführt.
314314
- [ ] Die Simulation meldet einen Fehler.
315315
> Groß- und Kleinschreibung zählt. Rot und rot sind verschiedene Texte.

‎web/lessons/diagramme/en/l09-ampel.visustruct‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@
55
</strelem>
66
<strelem typ="2" zx="0" zy="0">
77
<text>99;111;108;111;114;</text>
8-
<fall fallname="114;101;100;">
8+
<fall fallname="34;114;101;100;34;">
99
<strelem typ="0" zx="0" zy="0">
1010
<text>111;117;116;112;117;116;58;32;34;83;116;111;112;34;</text>
1111
</strelem>
1212
</fall>
13-
<fall fallname="121;101;108;108;111;119;">
13+
<fall fallname="34;121;101;108;108;111;119;34;">
1414
<strelem typ="0" zx="0" zy="0">
1515
<text>111;117;116;112;117;116;58;32;34;87;97;105;116;34;</text>
1616
</strelem>
1717
</fall>
18-
<fall fallname="103;114;101;101;110;">
18+
<fall fallname="34;103;114;101;101;110;34;">
1919
<strelem typ="0" zx="0" zy="0">
2020
<text>111;117;116;112;117;116;58;32;34;87;97;108;107;34;</text>
2121
</strelem>

‎web/lessons/diagramme/en/l09-rechner-loesung.visustruct‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,23 @@
1414
</strelem>
1515
<strelem typ="2" zx="0" zy="0">
1616
<text>111;112;101;114;97;116;111;114;</text>
17-
<fall fallname="43;">
17+
<fall fallname="34;43;34;">
1818
<strelem typ="0" zx="0" zy="0">
1919
<text>114;101;115;117;108;116;32;61;32;97;32;43;32;98;</text>
2020
</strelem>
2121
<strelem typ="0" zx="0" zy="0">
2222
<text>111;117;116;112;117;116;58;32;114;101;115;117;108;116;</text>
2323
</strelem>
2424
</fall>
25-
<fall fallname="45;">
25+
<fall fallname="34;45;34;">
2626
<strelem typ="0" zx="0" zy="0">
2727
<text>114;101;115;117;108;116;32;61;32;97;32;45;32;98;</text>
2828
</strelem>
2929
<strelem typ="0" zx="0" zy="0">
3030
<text>111;117;116;112;117;116;58;32;114;101;115;117;108;116;</text>
3131
</strelem>
3232
</fall>
33-
<fall fallname="42;">
33+
<fall fallname="34;42;34;">
3434
<strelem typ="0" zx="0" zy="0">
3535
<text>114;101;115;117;108;116;32;61;32;97;32;42;32;98;</text>
3636
</strelem>

‎web/lessons/diagramme/l09-ampel.visustruct‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@
55
</strelem>
66
<strelem typ="2" zx="0" zy="0">
77
<text>102;97;114;98;101;</text>
8-
<fall fallname="114;111;116;">
8+
<fall fallname="34;114;111;116;34;">
99
<strelem typ="0" zx="0" zy="0">
1010
<text>111;117;116;112;117;116;58;32;34;83;116;101;104;101;110;32;98;108;101;105;98;101;110;34;</text>
1111
</strelem>
1212
</fall>
13-
<fall fallname="103;101;108;98;">
13+
<fall fallname="34;103;101;108;98;34;">
1414
<strelem typ="0" zx="0" zy="0">
1515
<text>111;117;116;112;117;116;58;32;34;87;97;114;116;101;110;34;</text>
1616
</strelem>
1717
</fall>
18-
<fall fallname="103;114;252;110;">
18+
<fall fallname="34;103;114;252;110;34;">
1919
<strelem typ="0" zx="0" zy="0">
2020
<text>111;117;116;112;117;116;58;32;34;71;101;104;101;110;34;</text>
2121
</strelem>

‎web/lessons/diagramme/l09-rechner-loesung.visustruct‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,23 @@
1414
</strelem>
1515
<strelem typ="2" zx="0" zy="0">
1616
<text>122;101;105;99;104;101;110;</text>
17-
<fall fallname="43;">
17+
<fall fallname="34;43;34;">
1818
<strelem typ="0" zx="0" zy="0">
1919
<text>101;114;103;101;98;110;105;115;32;61;32;97;32;43;32;98;</text>
2020
</strelem>
2121
<strelem typ="0" zx="0" zy="0">
2222
<text>111;117;116;112;117;116;58;32;101;114;103;101;98;110;105;115;</text>
2323
</strelem>
2424
</fall>
25-
<fall fallname="45;">
25+
<fall fallname="34;45;34;">
2626
<strelem typ="0" zx="0" zy="0">
2727
<text>101;114;103;101;98;110;105;115;32;61;32;97;32;45;32;98;</text>
2828
</strelem>
2929
<strelem typ="0" zx="0" zy="0">
3030
<text>111;117;116;112;117;116;58;32;101;114;103;101;98;110;105;115;</text>
3131
</strelem>
3232
</fall>
33-
<fall fallname="42;">
33+
<fall fallname="34;42;34;">
3434
<strelem typ="0" zx="0" zy="0">
3535
<text>101;114;103;101;98;110;105;115;32;61;32;97;32;42;32;98;</text>
3636
</strelem>

‎web/lessons/diagramme/pt/l09-ampel.visustruct‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@
55
</strelem>
66
<strelem typ="2" zx="0" zy="0">
77
<text>99;111;114;</text>
8-
<fall fallname="118;101;114;109;101;108;104;111;">
8+
<fall fallname="34;118;101;114;109;101;108;104;111;34;">
99
<strelem typ="0" zx="0" zy="0">
1010
<text>111;117;116;112;117;116;58;32;34;80;97;114;97;34;</text>
1111
</strelem>
1212
</fall>
13-
<fall fallname="97;109;97;114;101;108;111;">
13+
<fall fallname="34;97;109;97;114;101;108;111;34;">
1414
<strelem typ="0" zx="0" zy="0">
1515
<text>111;117;116;112;117;116;58;32;34;69;115;112;101;114;97;34;</text>
1616
</strelem>
1717
</fall>
18-
<fall fallname="118;101;114;100;101;">
18+
<fall fallname="34;118;101;114;100;101;34;">
1919
<strelem typ="0" zx="0" zy="0">
2020
<text>111;117;116;112;117;116;58;32;34;65;118;97;110;231;97;34;</text>
2121
</strelem>

‎web/lessons/diagramme/pt/l09-rechner-loesung.visustruct‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,23 @@
1414
</strelem>
1515
<strelem typ="2" zx="0" zy="0">
1616
<text>111;112;101;114;97;100;111;114;</text>
17-
<fall fallname="43;">
17+
<fall fallname="34;43;34;">
1818
<strelem typ="0" zx="0" zy="0">
1919
<text>114;101;115;117;108;116;97;100;111;32;61;32;97;32;43;32;98;</text>
2020
</strelem>
2121
<strelem typ="0" zx="0" zy="0">
2222
<text>111;117;116;112;117;116;58;32;114;101;115;117;108;116;97;100;111;</text>
2323
</strelem>
2424
</fall>
25-
<fall fallname="45;">
25+
<fall fallname="34;45;34;">
2626
<strelem typ="0" zx="0" zy="0">
2727
<text>114;101;115;117;108;116;97;100;111;32;61;32;97;32;45;32;98;</text>
2828
</strelem>
2929
<strelem typ="0" zx="0" zy="0">
3030
<text>111;117;116;112;117;116;58;32;114;101;115;117;108;116;97;100;111;</text>
3131
</strelem>
3232
</fall>
33-
<fall fallname="42;">
33+
<fall fallname="34;42;34;">
3434
<strelem typ="0" zx="0" zy="0">
3535
<text>114;101;115;117;108;116;97;100;111;32;61;32;97;32;42;32;98;</text>
3636
</strelem>

‎web/lessons/en/10-fallauswahl.md‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ The same machine as a switch. If choice has the value 2, only column 2 runs.
3939
4040
## Cases with text
4141

42-
The cases do not have to be numbers. You can also choose by the content of a `String` variable. Then you write the text as the case name, for example `red`.
42+
The cases do not have to be numbers. You can also choose by the content of a `String` variable. Then you write the text in quotation marks as the case name, for example `"red"`. Just like in code, this shows that it is a text.
4343

4444
::: diagramm l09-ampel.visustruct
4545
A traffic light: depending on the colour typed in, a different message appears. In the simulation, also try a colour that does not exist.
4646
:::
4747

48-
Upper and lower case matter: `Red` does not match the case `red`.
48+
Upper and lower case matter: `Red` does not match the case `"red"`.
4949

5050
## Exercise: Grade in words
5151

@@ -75,7 +75,7 @@ test: 6, *, 7 -> 42
7575
test: 1, x, 2 -> Unknown operator
7676
braucht: fallauswahl
7777
tipp: First read in all three values. After that, a switch on the operator decides what is calculated.
78-
tipp: Before the switch, create `int result = 0`. In each case you calculate, for example, `result = a + b` and then output `result`. The case names are simply `+`, `-` and `*`.
78+
tipp: Before the switch, create `int result = 0`. In each case you calculate, for example, `result = a + b` and then output `result`. The case names are `"+"`, `"-"` and `"*"` in quotation marks, because the operator is a `String`.
7979
lösung: l09-rechner-loesung.visustruct
8080
:::
8181

@@ -307,9 +307,9 @@ Rate yourself honestly for each point: ☂️ not yet, ⛅ partly, ☀️ I can
307307
- [ ] Handling a colour such as red, yellow or green
308308
> “Above 30” is a range. For that you need a branch with a comparison.
309309
310-
? At the traffic light you type `Red`, and the case is called `red`. What happens?
310+
? At the traffic light you type `Red`, and the case is called `"red"`. What happens?
311311
→ How a switch is built
312-
- [ ] The case red runs.
312+
- [ ] The case `"red"` runs.
313313
- [x] The case default runs.
314314
- [ ] The simulation reports an error.
315315
> Upper and lower case matter. Red and red are different texts.

‎web/lessons/pt/10-fallauswahl.md‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ A mesma máquina como seleção. Se escolha tiver o valor 2, só é executada a
3939
4040
## Casos com texto
4141

42-
Os casos não têm de ser números. Também podes escolher pelo conteúdo de uma variável `String`. Então escreves o texto como nome do caso, por exemplo `vermelho`.
42+
Os casos não têm de ser números. Também podes escolher pelo conteúdo de uma variável `String`. Então escreves o texto entre aspas como nome do caso, por exemplo `"vermelho"`. Tal como no código, isto mostra que é um texto.
4343

4444
::: diagramm l09-ampel.visustruct
4545
Um semáforo: consoante a cor introduzida, aparece uma mensagem diferente. Na simulação, experimenta também uma cor que não existe.
4646
:::
4747

48-
Maiúsculas e minúsculas contam: `Vermelho` não corresponde ao caso `vermelho`.
48+
Maiúsculas e minúsculas contam: `Vermelho` não corresponde ao caso `"vermelho"`.
4949

5050
## Exercício: Nota por extenso
5151

@@ -75,7 +75,7 @@ test: 6, *, 7 -> 42
7575
test: 1, x, 2 -> Operador desconhecido
7676
braucht: fallauswahl
7777
tipp: Primeiro lê os três valores. Depois, uma seleção sobre o operador decide o que é calculado.
78-
tipp: Antes da seleção, cria `int resultado = 0`. Em cada caso calculas, por exemplo, `resultado = a + b` e depois mostras `resultado`. Os nomes dos casos são simplesmente `+`, `-` e `*`.
78+
tipp: Antes da seleção, cria `int resultado = 0`. Em cada caso calculas, por exemplo, `resultado = a + b` e depois mostras `resultado`. Os nomes dos casos são `"+"`, `"-"` e `"*"` entre aspas, porque o operador é uma `String`.
7979
lösung: l09-rechner-loesung.visustruct
8080
:::
8181

@@ -307,9 +307,9 @@ Avalia-te com honestidade em cada ponto: ☂️ ainda não, ⛅ em parte, ☀️
307307
- [ ] Tratar uma cor como vermelho, amarelo ou verde
308308
> “Acima dos 30” é um intervalo. Para isso precisas de uma decisão com uma comparação.
309309
310-
? No semáforo escreves `Vermelho`, e o caso chama-se `vermelho`. O que acontece?
310+
? No semáforo escreves `Vermelho`, e o caso chama-se `"vermelho"`. O que acontece?
311311
→ Como se constrói uma seleção
312-
- [ ] É executado o caso vermelho.
312+
- [ ] É executado o caso `"vermelho"`.
313313
- [x] É executado o caso default.
314314
- [ ] A simulação indica um erro.
315315
> Maiúsculas e minúsculas contam. Vermelho e vermelho são textos diferentes.

0 commit comments

Comments
 (0)