Skip to content

Commit d75bb35

Browse files
author
Heinonen Ava R
committed
exercises part 2 done
1 parent 23a76a7 commit d75bb35

File tree

1 file changed

+23
-17
lines changed

1 file changed

+23
-17
lines changed

data/osa-2/4-metodit.md

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1019,22 +1019,22 @@ public static double methodThatReturnsFloatingPointNumber() {
10191019
</table>
10201020

10211021

1022-
<programming-exercise name='Numero uno' tmcname='osa02-Osa02_27.NumeroUno'>
1022+
<programming-exercise name='Number uno' tmcname='part02-Part02_27.NumberUno'>
10231023

10241024
<!-- Kirjoita metodi `public static int numeroUno()`, joka palauttaa arvon 1. -->
10251025

1026-
Write a method `public static int numeroUno()` that returns the value 1.
1026+
Write a method `public static int numberUno()` that returns the value 1.
10271027

10281028
</programming-exercise>
10291029

10301030

10311031
<!-- <programming-exercise name='Merkkijono' tmcname='osa02-Osa02_28.Merkkijono'> -->
1032-
<programming-exercise name='String' tmcname='osa02-Osa02_28.Merkkijono'>
1032+
<programming-exercise name='Word' tmcname='part02-Part02_28.Word'>
10331033

10341034

10351035
<!-- Kirjoita metodi `public static String merkkijono()`. Metodin tulee palauttaa itse päättämäsi merkkijono. -->
10361036

1037-
Write a method `public static String string()`. The method must return a string of your choice.
1037+
Write a method `public static String word()`. The method must return a string of your choice.
10381038

10391039
</programming-exercise>
10401040

@@ -1415,7 +1415,7 @@ Now the value of the variable `number1` is copied as the value of the method par
14151415

14161416
<!-- <programming-exercise name='Lukujen summa' tmcname='osa02-Osa02_29.LukujenSumma'> -->
14171417

1418-
<programming-exercise name='Sum of numbers' tmcname='osa02-Osa02_29.LukujenSumma'>
1418+
<programming-exercise name='Summation' tmcname='part02-Part02_29.Summation'>
14191419

14201420

14211421
<!-- Täydennä tehtäväpohjassa olevaa metodia `summa` siten, että se laskee ja palauttaa parametrina olevien lukujen summan. -->
@@ -1475,7 +1475,7 @@ Sum: 14
14751475

14761476
<!-- <programming-exercise name='Pienin' tmcname='osa02-Osa02_30.Pienin'> -->
14771477

1478-
<programming-exercise name='Smallest' tmcname='osa02-Osa02_30.Pienin'>
1478+
<programming-exercise name='Smallest' tmcname='part02-Part02_30.Smallest'>
14791479

14801480

14811481
<!-- Tee kaksiparametrinen metodi `pienin`, joka palauttaa parametrina saamistaan luvuista pienemmän arvon. Jos lukujen arvo on sama, voidaan palauttaa kumpi tahansa luvuista. -->
@@ -1532,7 +1532,7 @@ Smallest: 2
15321532

15331533
<!-- <programming-exercise name='Suurin' tmcname='osa02-Osa02_31.Suurin'> -->
15341534

1535-
<programming-exercise name='Greatest' tmcname='osa02-Osa02_31.Suurin'>
1535+
<programming-exercise name='Greatest' tmcname='part02-Part02_31.Greatest'>
15361536

15371537

15381538
<!-- Tee metodi `suurin`, joka saa kolme lukua ja palauttaa niistä suurimman. Jos suurimpia arvoja on useita, riittää niistä jonkun palauttaminen. Tulostus tapahtuu pääohjelmassa. -->
@@ -1573,7 +1573,7 @@ Suurin: 7
15731573

15741574
<sample-output>
15751575

1576-
Suurin: 7
1576+
Greatest: 7
15771577

15781578
</sample-output>
15791579

@@ -1582,7 +1582,7 @@ Suurin: 7
15821582

15831583
<!-- <programming-exercise name='Lukujen keskiarvo' tmcname='osa02-Osa02_32.LukujenKeskiarvo'> -->
15841584

1585-
<programming-exercise name='Average of numbers' tmcname='osa02-Osa02_32.LukujenKeskiarvo'>
1585+
<programming-exercise name='Averaging' tmcname='part02-Part02_32.Averaging'>
15861586

15871587

15881588
<!-- Tee metodi `keskiarvo`, joka laskee parametrina olevien lukujen keskiarvon. Metodin sisällä tulee käyttää apuna edellä tehtyä metodia `summa`! -->
@@ -2074,7 +2074,7 @@ Below is a visualization of the method call `multiplicationTable(3)`. Notice how
20742074

20752075
<!-- <programming-exercise name='Tulostelua (4 osaa)' tmcname='osa02-Osa02_33.Tulostelua'> -->
20762076

2077-
<programming-exercise name='Doing some printing (4 parts)' tmcname='osa02-Osa02_33.Tulostelua'>
2077+
<programming-exercise name='Star sign (4 parts)' tmcname='part02-Part02_33.Star sign'>
20782078

20792079

20802080

@@ -2144,10 +2144,12 @@ The output of the program:
21442144
Define a method called `printSquare(int lengthOfSide)` that prints a suitable square with the help of the `printStars` method. So the method call `printSquare(4)` results in the following output:
21452145

21462146
<sample-output>
2147+
21472148
****
21482149
****
21492150
****
21502151
****
2152+
21512153
</sample-output>
21522154

21532155
<!-- **Huom:** tehtävässä ei riitä että tulostus näyttää oikealta, tulostaNelio-metodin sisällä neliön "rivien" tulostus tulee tehdä tulostaTahtia-metodia käyttäen. -->
@@ -2168,25 +2170,29 @@ When creating the program, you might benefit from the test code in the main to e
21682170
Write a method called `printRectangle(int width, int height`) that prints the correct rectangle by using the `printStars` method. So the method call `printRectangle(17, 3)` should produce the following output:
21692171

21702172
<sample-output>
2173+
21712174
*****************
21722175
*****************
21732176
*****************
2177+
21742178
</sample-output>
21752179

21762180

21772181
<!-- <h2>Vasemmalle nojaavan kolmion tulostus</h2> -->
21782182

2179-
<h2>Printing a left-leaning triangle</h2>
2183+
<h2>Printing a triangle</h2>
21802184

21812185
<!-- Tee metodi `tulostaKolmio(int koko)` joka tulostaa kolmion käyttäen `tulostaTahtia`-metodia. Siis esimerkiksi kutsu `tulostaKolmio(4)` tulostaa seuraavaa: -->
21822186

21832187
Create a method called `printTriangle(int size)` that prints a triangle by using the `printStars` method. So the call `printTriangle(4)` should print the following:
21842188

21852189
<sample-output>
2190+
21862191
*
21872192
**
21882193
***
21892194
****
2195+
21902196
</sample-output>
21912197

21922198
</programming-exercise>
@@ -2195,16 +2201,16 @@ Create a method called `printTriangle(int size)` that prints a triangle by using
21952201
<!-- <programming-exercise name='Tulostelua Like A Boss (3 osaa)' tmcname='osa02-Osa02_34.TulosteluaLikeABoss'> -->
21962202

21972203

2198-
<programming-exercise name='Printing Like A Boss (3 parts)' tmcname='osa02-Osa02_34.TulosteluaLikeABoss'>
2204+
<programming-exercise name='Advanced astrology (3 parts)' tmcname='part02-Part02_34.Advanced astrology'>
21992205

22002206

22012207
<!-- <h2>Tähtirivin ja tyhjien tulostus</h2> -->
22022208

2203-
<h2>Printing a row of stars and empty spaces</h2>
2209+
<h2>Printing stars and spaces</h2>
22042210

22052211
<!-- Tee metodi `tulostaTyhjaa(int maara)` joka tulostaa `maara` kappaletta välilyöntejä. Metodi ei tulosta rivinvaihtoa. -->
22062212

2207-
Define a method called `printEmpty(int number)` that produces the number of spaces specified by `number`. The method does not print the line break.
2213+
Define a method called `printSpaces(int number)` that produces the number of spaces specified by `number`. The method does not print the line break.
22082214

22092215
<!-- Joudut myös joko kopioimaan edellisen tehtävän vastauksestasi metodin `tulostaTahtia` tai toteuttamaan sen uudelleen tämän tehtävän tehtäväpohjaan. -->
22102216

@@ -2216,7 +2222,7 @@ You will also have to either copy the `printStars` method your previous answer o
22162222

22172223
<!-- Tee metodi `tulostaKolmio(int koko)` joka tulostaa kolmion käyttäen `tulostaTyhjaa`- ja `tulostaTahtia`-metodeja. Siis esimerkiksi kutsu `tulostaKolmio(4)` tulostaa seuraavaa: -->
22182224

2219-
Create a method called `printTriangle(int size)` that uses `printEmpty` and `printStars` to print the correct triangle. So the method call `printTriangle(4)` should print the following:
2225+
Create a method called `printTriangle(int size)` that uses `printSpaces` and `printStars` to print the correct triangle. So the method call `printTriangle(4)` should print the following:
22202226

22212227
<sample-output>
22222228
*
@@ -2232,7 +2238,7 @@ Create a method called `printTriangle(int size)` that uses `printEmpty` and `pri
22322238

22332239
<!-- Tee metodi `jouluKuusi(int korkeus)` joka tulostaa joulukuusen. Joulukuusi koostuu annetun korkuisesta kolmiosta ja jalasta. Jalka on kaksi tähteä korkea ja kolme tähteä leveä ja se on keskellä kolmion pohjaa. Kuusi tulee rakentaa käyttämällä tulostukseen metodeja `tulostaTyhjaa` ja `tulostaTahtia` -->
22342240

2235-
Define a method called `christmasTree(int height)` that prints the correct Christmas tree. The Christmas tree consists of a triangle with the specified height and the base. The base is two stars high and three stars wide, and is placed at the center of the triangle's bottom. The tree is to be constructed by using the methods `printEmpty` and `printStars`.
2241+
Define a method called `christmasTree(int height)` that prints the correct Christmas tree. The Christmas tree consists of a triangle with the specified height and the base. The base is two stars high and three stars wide, and is placed at the center of the triangle's bottom. The tree is to be constructed by using the methods `printSpaces` and `printStars`.
22362242

22372243
<!-- Esimerkiksi kutsu `jouluKuusi(4)` tulostaa seuraavaa: -->
22382244

@@ -2270,7 +2276,7 @@ The call `christmasTree(10)` should print:
22702276

22712277
<!-- **Huom:** korkeuksien jotka ovat alle 3 ei tarvitse toimia! -->
22722278

2273-
**N.B.:** lengths shorter that 3 don't have work correctly!
2279+
**N.B.:** heights shorter that 3 don't have work correctly!
22742280

22752281

22762282
</programming-exercise>

0 commit comments

Comments
 (0)