Skip to content

Commit e3a898f

Browse files
committed
Merge branch 'master' of https://github.com/Nurou/programming-20
2 parents d3a9326 + e2e4fad commit e3a898f

File tree

96 files changed

+5199
-4837
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+5199
-4837
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Ohjelmointi 19
1+
# Ohjelmointi 20
22

33
## Development environment
44

24.2 KB
Loading
29.3 KB
Loading
24.2 KB
Loading
Loading
21.7 KB
Loading

data/img/part1.2-sout.gif

231 KB
Loading

data/img/part1.6-block-example-1.png

13 KB
Loading

data/img/part1.6-block-example-2.png

13.3 KB
Loading

data/macos-ohjeet.md

+35-17
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,42 @@ hidden: false
55
information_page: true
66
---
77

8-
## Käyttöliittymätestit
8+
<!-- ## Käyttöliittymätestit -->
9+
## User interface tests
910

10-
Osa käyttöliittymätesteistä odottaa, että NetBeans/tmcbeans saa siirtää hiiren kursoria näytöllä, esimerkiksi testatakseen tehtävässä tehdyn käyttöliittymän nappuloita. macOS ei oletuksena salli turvasyistä ohjelmia siirtämään hiirtä, joten tmcbeans:lle pitää käydä lisäämässä oikeus tätä varten.
11+
<!-- Osa käyttöliittymätesteistä odottaa, että NetBeans/tmcbeans saa siirtää hiiren kursoria näytöllä, esimerkiksi testatakseen tehtävässä tehdyn käyttöliittymän nappuloita. macOS ei oletuksena salli turvasyistä ohjelmia siirtämään hiirtä, joten tmcbeans:lle pitää käydä lisäämässä oikeus tätä varten. -->
12+
Some of the user interface tests expect that Netbeans/tmcbeans is allowed to move the mouse cursor on the screen. For example to test the buttons in the UI that are created in the exercise. MacOS does not allow this because of the security concerns. This is why tmcbeans has to be given the permission manually.
1113

12-
Oikeuden voi lisätä seuraavasti:
1314

14-
1. Avaa ensin System Preferences. Voit avata sen esimerkiksi hakemalla Spotlight:sta (suurennuslasikuvake oikeassa yläkulmassa) system preferences, ja avaamalla sieltä System Preferences.app.
15+
16+
<!-- Oikeuden voi lisätä seuraavasti: -->
17+
The permission can be added as follows:
18+
19+
<!-- 1. Avaa ensin System Preferences. Voit avata sen esimerkiksi hakemalla Spotlight:sta (suurennuslasikuvake oikeassa yläkulmassa) system preferences, ja avaamalla sieltä System Preferences.app. -->
20+
1. Open the `System Preferences`. You can open it from example by searching from Spotlight (magnifying glass on the upper right corner) by keyword _System Preferences_ and by opening the `System Preferences.app`.
21+
1522
![spotlight haku](./img/macos-guide/search_system_preferences.png)
16-
2. Paina avautuvassa näkymässä yläriviltä löytyvää Security & Privacy.
17-
![system preferences näkymä](./img/macos-guide/system_preferences.png)
18-
3. Navigoi näkymässä Privacy-välilehdelle ja siellä Accessibility -osioon.
19-
![privacy-->accessibility näkymä](./img/macos-guide/navigation.png)
20-
4. Paina vasemmasta alakulmasta "Click the lock to make changes." Username-kentässä pitäisi lukea automaattisesti tietokoneesi käyttäjätunnus. Syötä se, jos se puuttuu. Syötä salasanasi Password-kenttään ja paina Unlock.
21-
![salasanansyöttämisnäkymä](./img/macos-guide/open-lock.png)
22-
7. Paina nyt plus-kuvaketta. Navigoi avautuvassa näkymässä siihen kansioon, mihin tmcbeans on asennettuna koneellasi. Valitse tmcbeans.app ja paina Open.
23-
![Finder-hakemisto, jossa navigoitu tmcbeansiin](./img/macos-guide/add_tmcbeans.png)
24-
![accessibility-näkymä, johon on lisätty tmcbeans](./img/macos-guide/tmcbeans_added.png)
25-
9. Paina vasemmasta alakulmasta "Click the lock to prevent further changes."
26-
![accessibility-näkymä, johon ei voi tehdä enää muutoksia](./img/macos-guide/done.png)
27-
28-
Nyt tmcbeans pitäisi pystyä siirtämään hiirtä testien ajossa. Huomaathan, että et saa samanaikaisesti siirtää itse hiirtä tai availla ikkunoita, kun testit pyörivät. Testien pitää saada rauhassa navigoida yksin näytöllä, jotta ne testaavat oikein ohjelmasi toimintaa.
23+
24+
<!-- 2. Paina avautuvassa näkymässä yläriviltä löytyvää Security & Privacy.
25+
![system preferences näkymä](./img/macos-guide/system_preferences.png) -->
26+
2. Press the `Security & Privacy` from the opened menu.
27+
28+
<!-- 3. Navigoi näkymässä Privacy-välilehdelle ja siellä Accessibility -osioon.
29+
![privacy2accessibility näkymä](./img/macos-guide/navigation.png) -->
30+
3. From there navigate to `Privacy` tab and from there to `Accessability section`.
31+
32+
<!-- 4. Paina vasemmasta alakulmasta "Click the lock to make changes." Username-kentässä pitäisi lukea automaattisesti tietokoneesi käyttäjätunnus. Syötä se, jos se puuttuu. Syötä salasanasi Password-kenttään ja paina Unlock.
33+
![salasanansyöttämisnäkymä](./img/macos-guide/open-lock.png) -->
34+
4. Press from the lower left corner "Click the lock to make changes.". In the username field there should be the name of your computer. Write if it's not there. Give your password in the password field and click Unlock.
35+
36+
<!-- 7. Paina nyt plus-kuvaketta. Navigoi avautuvassa näkymässä siihen kansioon, mihin tmcbeans on asennettuna koneellasi. Valitse tmcbeans.app ja paina Open. -->
37+
7. Click the plus-icon. Navigate to the folder where your tmcbeans is installed. Select tmcbeans.app and click Open.
38+
![Finder navigated to the tmcbeans](./img/macos-guide/add_tmcbeans.png)
39+
![accessibility-view with tmcbeans added](./img/macos-guide/tmcbeans_added.png)
40+
41+
<!-- 9. Paina vasemmasta alakulmasta "Click the lock to prevent further changes." -->
42+
9. In the lower left corner, click "Click the lock to prevent further changes."
43+
![accessibility-view, that doesn't allow more modifications](./img/macos-guide/done.png)
44+
45+
<!-- Nyt tmcbeans pitäisi pystyä siirtämään hiirtä testien ajossa. Huomaathan, että et saa samanaikaisesti siirtää itse hiirtä tai availla ikkunoita, kun testit pyörivät. Testien pitää saada rauhassa navigoida yksin näytöllä, jotta ne testaavat oikein ohjelmasi toimintaa. -->
46+
Now your tmcbeans should be able to move your mouse cursor during the execution of tests. Note that you may not be allowed to move your cursor or open windows during the tests. Tests should be allowed to run without interference in order for them to work correctly.

data/osa-1/1-starting-programming.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ hidden: false
1515
</text-box>
1616

1717

18-
<quiznator id="5c12b7f263de8e5db0cf8b8e"></quiznator>
18+
<quiz id="3799f901-ef2a-53da-b4c6-669fbbf0038a"></quiz>
1919

2020
TODO aloituskysely englanniksi
2121

@@ -152,4 +152,4 @@ In order to work Java-programs require a code boilerplate, which will become fam
152152
<!-- Alla on kurssin ensimmäinen kyselytehtävä. Kyselytehtäviin vastataan suoraan kurssimateriaalissa. -->
153153
Below is the first quizz of the course. Quizzes can be answered straight in the course material.
154154

155-
<quiznator id="5c136a4ea50dbe1223d1981d"></quiznator>
155+
<quiz id="118e6b38-0d42-5667-a674-84ae174ad798"></quiz>

data/osa-1/2-printing.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ Writing the command `System.out.println("...") can be pretty cumbersome. In NetB
389389

390390
Animation below illustrates the use of sout-command. First user writes sout and then pressed tabulator. A Magic Trick!
391391

392-
![](../img/sout.gif)
392+
![](../img/part1.2-sout.gif)
393393

394394
</text-box>
395395

data/osa-1/3-reading-input.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,7 @@ I will tell you a story, but I need some information first.
606606
What is the main character called?
607607
**Bob**
608608
What is their job?
609-
**builder**
609+
**a builder**
610610
Here is the story:
611611
Once upon a time there was Bob, who was a builder.
612612
On the way to work, Bob reflected on life.
@@ -638,7 +638,7 @@ I will tell you a story, but I need some information first.
638638
What is the main character called?
639639
**Ada**
640640
What is their job?
641-
**Data scientist**
641+
**a Data scientist**
642642
Here is the story:
643643
Once upon a time there was Ada, who was a Data scientist.
644644
On the way to work, Ada reflected on life.

data/osa-1/4-muuttujat.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -242,25 +242,25 @@ The value of the variable is 42
242242

243243
Let's look at the preceding program's execution step-by-step. When a variable appears in the program for the first time, i.e., the computer is told both its type (here `int`) and its name (here `value`), the computer creates a 'named container' for the variable. Then, the value on the right side of the equals sign is copied into this named container.
244244

245-
![](../img/drawings/muuttujan-arvon-vaihto-1.png)
245+
![](../img/drawings/part1.4-variable-change-1.png)
246246

247247
<!-- Kun ohjelmakoodissa viitataan muuttujaan sen nimellä -- tässä halutaan tulostaa merkkijono "Muuttujan arvo on " sekä muuttujan `luku` arvo, muuttujan `luku` arvo haetaan sen nimellä löytyvästä lokerosta. -->
248248

249249
Whenever a variable is referenced by its name in a program -- here, we want to print the string "The value of the variable is " followed by the value of the `value` variable -- its value is retrieved from a container that has its name.
250250

251-
![](../img/drawings/muuttujan-arvon-vaihto-2.png)
251+
![](../img/drawings/part1.4-variable-change-2.png)
252252

253253
<!-- Kun muuttujaan asetetaan arvo (tässä `luku = 42`), tarkistetaan ensin löytyykö muuttujan nimistä lokeroa. Jos lokero löytyy, uusi arvo kopioidaan lokeroon vanhan arvon tilalle ja vanha arvo katoaa. Jos muuttujan nimellä ei löydy lokeroa, ohjelman suoritus päättyy virheilmoitukseen tai ohjelmaa ei voida käynnistää. -->
254254

255255
Whenever a value is assigned to a variable (here `value = 42`), a check is run to see whether a container with the given name already exists. If one does, a new value is copied in the place of the old value, and the old value disappears. If a container of the variable name is not found, the program execution ends in an error message, or it fails to run.
256256

257-
![](../img/drawings/muuttujan-arvon-vaihto-3.png)
257+
![](../img/drawings/part1.4-variable-change-3.png)
258258

259259
<!-- Seuraavaksi ohjelmakoodissa viitataan taas muuttujaan sen nimellä -- tässäkin halutaan tulostaa merkkijono "Muuttujan arvo on " sekä muuttujan `luku` arvo. Toimitaan kuten normaalisti, eli haetaan muuttujan `luku` arvo sen nimellä löytyvästä lokerosta. -->
260260

261261
The variable is then referenced again by its name in the program -- we again want to print the string "The value of the variable is " followed by the value of the `value` variable. We proceed as normal, retrieving the value of `value` from a container having its name.
262262

263-
![](../img/drawings/muuttujan-arvon-vaihto-4.png)
263+
![](../img/drawings/part1.4-variable-change-4.png)
264264

265265
<!-- Kuten huomaat, ohjelman lopputilanteessa muuttujan alkuperäinen arvo on kadonnut. Muuttuja voi sisältää kerrallaan aina vain yhden arvon. -->
266266

data/osa-1/5-laskentaa-luvuilla.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ How many days would you like to convert to seconds?
176176
</programming-exercise>
177177

178178

179-
<quiznator id="5c12b7f263de8e5db0cf8b8f"></quiznator>
179+
<quiz id="54056702-b227-5747-8d6c-d3f15e8f5c8a"></quiz>
180180

181181

182182
<text-box variant='hint' name='Expression and Statement'>
@@ -245,7 +245,7 @@ int second = 4;
245245
first + second;
246246
```
247247

248-
<quiznator id="5c12b7f263de8e5db0cf8b90"></quiznator>
248+
<quiz id="f9af4add-d06f-59bb-ab42-d1cb9733ba88"></quiz>
249249

250250

251251
<!-- ## Laskentaa ja tulostamista -->
@@ -938,7 +938,7 @@ The average is 4.333333333333333
938938
</programming-exercise>
939939

940940

941-
<quiznator id="5c12b7f263de8e5db0cf8b91"></quiznator>
941+
<quiz id="cff67523-26f0-5f35-b00f-070778b40541"></quiz>
942942

943943

944944
<!-- <programming-exercise name="Nelilaskin" tmcname='osa01-Osa01_23.Nelilaskin'> -->
@@ -1135,4 +1135,4 @@ You'll find a step-by-step visualization of the previous program below, which go
11351135

11361136
<code-states-visualizer input='{"code":"public class CalculationInSteps {\n public static void main(String[] args) {\n int first = (1 + 1);\n int second = first + 3 * (2 + 5);\n\n first = 5;\n\n int third = first + second;\n System.out.println(first);\n System.out.println(second);\n System.out.println(third);\n }\n}","stdin":"","trace":[{"stdout":"","event":"call","line":3,"stack_to_render":[{"func_name":"main:3","encoded_locals":{},"ordered_varnames":[],"parent_frame_id_list":[],"is_highlighted":true,"is_zombie":false,"is_parent":false,"unique_hash":"1","frame_id":1}],"globals":{},"ordered_globals":[],"func_name":"main","heap":{}},{"stdout":"","event":"step_line","line":3,"stack_to_render":[{"func_name":"main:3","encoded_locals":{},"ordered_varnames":[],"parent_frame_id_list":[],"is_highlighted":true,"is_zombie":false,"is_parent":false,"unique_hash":"2","frame_id":2}],"globals":{},"ordered_globals":[],"func_name":"main","heap":{}},{"stdout":"","event":"step_line","line":4,"stack_to_render":[{"func_name":"main:4","encoded_locals":{"first":2},"ordered_varnames":["first"],"parent_frame_id_list":[],"is_highlighted":true,"is_zombie":false,"is_parent":false,"unique_hash":"4","frame_id":4}],"globals":{},"ordered_globals":[],"func_name":"main","heap":{}},{"stdout":"","event":"step_line","line":6,"stack_to_render":[{"func_name":"main:6","encoded_locals":{"first":2,"second":23},"ordered_varnames":["first","second"],"parent_frame_id_list":[],"is_highlighted":true,"is_zombie":false,"is_parent":false,"unique_hash":"9","frame_id":9}],"globals":{},"ordered_globals":[],"func_name":"main","heap":{}},{"stdout":"","event":"step_line","line":8,"stack_to_render":[{"func_name":"main:8","encoded_locals":{"first":5,"second":23},"ordered_varnames":["first","second"],"parent_frame_id_list":[],"is_highlighted":true,"is_zombie":false,"is_parent":false,"unique_hash":"12","frame_id":12}],"globals":{},"ordered_globals":[],"func_name":"main","heap":{}},{"stdout":"","event":"step_line","line":9,"stack_to_render":[{"func_name":"main:9","encoded_locals":{"first":5,"second":23,"third":28},"ordered_varnames":["first","second","third"],"parent_frame_id_list":[],"is_highlighted":true,"is_zombie":false,"is_parent":false,"unique_hash":"17","frame_id":17}],"globals":{},"ordered_globals":[],"func_name":"main","heap":{}},{"stdout":"5\n","event":"step_line","line":10,"stack_to_render":[{"func_name":"main:10","encoded_locals":{"first":5,"second":23,"third":28},"ordered_varnames":["first","second","third"],"parent_frame_id_list":[],"is_highlighted":true,"is_zombie":false,"is_parent":false,"unique_hash":"21","frame_id":21}],"globals":{},"ordered_globals":[],"func_name":"main","heap":{}},{"stdout":"5\n23\n","event":"step_line","line":11,"stack_to_render":[{"func_name":"main:11","encoded_locals":{"first":5,"second":23,"third":28},"ordered_varnames":["first","second","third"],"parent_frame_id_list":[],"is_highlighted":true,"is_zombie":false,"is_parent":false,"unique_hash":"24","frame_id":24}],"globals":{},"ordered_globals":[],"func_name":"main","heap":{}},{"stdout":"5\n23\n28\n","event":"step_line","line":12,"stack_to_render":[{"func_name":"main:12","encoded_locals":{"first":5,"second":23,"third":28},"ordered_varnames":["first","second","third"],"parent_frame_id_list":[],"is_highlighted":true,"is_zombie":false,"is_parent":false,"unique_hash":"27","frame_id":27}],"globals":{},"ordered_globals":[],"func_name":"main","heap":{}},{"stdout":"5\n23\n28\n","event":"return","line":12,"stack_to_render":[{"func_name":"main:12","encoded_locals":{"first":5,"second":23,"third":28,"__return__":["VOID"]},"ordered_varnames":["first","second","third","__return__"],"parent_frame_id_list":[],"is_highlighted":true,"is_zombie":false,"is_parent":false,"unique_hash":"28","frame_id":28}],"globals":{},"ordered_globals":[],"func_name":"main","heap":{}}],"userlog":"Debugger VM maxMemory: 455M\n"}'></code-states-visualizer>
11371137

1138-
<quiznator id="5c12b7f263de8e5db0cf8b92"></quiznator>
1138+
<quiz id="286b44eb-0a4f-51de-9c67-68d5351a3b37"></quiz>

0 commit comments

Comments
 (0)