Skip to content

Commit 28e8f9d

Browse files
committed
Part-8
1 parent a04b9bd commit 28e8f9d

3 files changed

Lines changed: 8 additions & 7 deletions

File tree

data/part-8/1-recap.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -289,20 +289,21 @@ Second: 0/100
289289

290290
<!-- Toteutetaan edellä kuvattu interaktiivinen ohjelma kahden nestesäiliön käsittelyyn uudestaan. Tällä kertaa luodaan ohjelman toteutusta varten luokka "Sailio", jonka vastuulla on säiliön sisällön ylläpito. -->
291291

292-
Let's redo the previous program for handling two liquid containers. This time we'll create a class "Container", which is responsible for managing the contents of a container.
292+
Let's redo the previous program for handling two liquid containers. This time we'll create a class `Container`, which is responsible for managing the contents of a container.
293293

294294

295295
<h2>Container</h2>
296296

297297
<!-- Toteuta luokka Sailio. Säiliöllä tulee olla parametriton konstruktori sekä seuraavat metodit: -->
298-
Make a class called Container. The class must have a constructor which does not take any parameters, and the following methods:
298+
Make a class called `Container`. The class must have a constructor which does not take any parameters, and the following methods:
299299

300300
<!-- - `public int sisalto()` palauttaa säiliössä olevan nesteen määrän kokonaislukuna. -->
301301
- `public int contains()` which returns the amount of liquid in a container as an integer.
302302

303303
<!-- - `public void add(int maara)` lisää parametrina annetun määrän nestettä säiliöön. Mikäli parametrin arvo on negatiivinen, ei nestettä lisätä. Lisäyksen jälkeen säiliössä on korkeintaan 100 yksikköä nestettä. -->
304304
- `public void add(int amount)` which adds the amount of liquid given as a parameter to the container. If the amount is negative, no liquid is added.
305305
A container can hold maximum of 100 units of liquid.
306+
306307
<!-- - `public void remove(int maara)` poistaa parametrina annetun määrän nestettä säiliöstä. Mikäli parametrin arvo on negatiivinen, ei nestettä poisteta. Poistaminen poistaa vain olemassaolevaa nestettä -- poiston takia säiliössä ei voi koskaan olla alle nollaa nesteyksikköä. -->
307308
- `public void remove(int amount)` which removes the amount of liquid given as a parameter from the container. If the amount is negative, no liquid is removed. A container can never hold less than 0 units of liquid.
308309

@@ -342,7 +343,7 @@ System.out.println(container);
342343
<h2>Functionality</h2>
343344

344345
<!-- Kopioi ensimmäisessä osassa toteuttamasi käyttöliittymä ja muokkaa sitä siten, että ohjelmassa käytetään juuri toteuttamiasi säiliöitä. Luokassa `NestesailiotOlioilla` olevan main-metodin suorituksen tulee käynnistää ohjelma. -->
345-
Copy the user interface you implemented for the previous example, and modify it to use the new Container class.
346+
Copy the user interface you implemented for the previous example, and modify it to use the new `Container` class.
346347
The main method in the class `LiquidContainers2` must start the program.
347348

348349
<!-- Alla on esimerkkitulostus. Ohjelman tekstikäyttöliittymän toiminnan tulee olla seuraavanlainen: -->

data/part-8/2-hash-map.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ HashMap<String, Book> directory = new HashMap<>();
283283
```
284284

285285
<!-- Yllä oleva hajautustaulu käyttää avaimena `String`-oliota. Laajennetaan esimerkkiä siten, että hakemistoon lisätään kaksi kirjaa, `"Järki ja tunteet"` ja `"Ylpeys ja ennakkoluulo"`. -->
286-
The hash map above uses a`String` object as a key. Let's expand the example so that two books are added to the directory, `"Sense and Sensibility"` and `"Pride and Predujice"`.
286+
The hash map above uses a`String` object as a key. Let's expand the example so that two books are added to the directory, `"Sense and Sensibility"` and `"Pride and prideAndPrejudice"`.
287287

288288
<!-- ```java
289289
Book jarkiJaTunteet = new Book("Järki ja tunteet", 1811, "...");
@@ -295,11 +295,11 @@ hakemisto.put(ylpeysJaEnnakkoluulo.getNimi(), ylpeysJaEnnakkoluulo);
295295
``` -->
296296
```java
297297
Book senseAndSensibility = new Book("Sense and Sensibility", 1811, "...");
298-
Book prideAndPredujice = new Book("Pride and Prejudice", 1813, "....");
298+
Book prideAndPrejudice = new Book("Pride and Prejudice", 1813, "....");
299299

300300
HashMap<String, Book> directory = new HashMap<>();
301301
directory.put(senseAndSensibility.getName(), senseAndSensibility);
302-
directory.put(prideAndPrejudice.getName(), prideAndPrejuice);
302+
directory.put(prideAndPrejudice.getName(), prideAndPrejudice);
303303
```
304304

305305
<!-- Hakemistosta voi hakea kirjoja kirjan nimellä. Haku kirjalla `"Viisasteleva sydän"` ei tuota osumaa, jolloin hajautustaulu palauttaa `null`-viitteen. Book "Ylpeys ja ennakkoluulo" kuitenkin löytyy. -->

data/part-8/3-similarity-of-objects.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,7 @@ Vinkki! Voit luoda metodiin `tulostaOmistajat` listan, jota käytät jo tulostet
744744

745745
<h2>Expanded vehicle registry</h2>
746746

747-
Add the following methods to the VehicleRegistry:
747+
Add the following methods to the `VehicleRegistry`:
748748

749749
- `public void printLicensePlates()`prints the license plates in the registry.
750750

0 commit comments

Comments
 (0)