You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<!-- Tee kaksiparametrinen metodi `pienin`, joka palauttaa parametrina saamistaan luvuista pienemmän arvon. Jos lukujen arvo on sama, voidaan palauttaa kumpi tahansa luvuista. -->
<!-- Tee metodi `suurin`, joka saa kolme lukua ja palauttaa niistä suurimman. Jos suurimpia arvoja on useita, riittää niistä jonkun palauttaminen. Tulostus tapahtuu pääohjelmassa. -->
<!-- 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
@@ -2144,10 +2144,12 @@ The output of the program:
2144
2144
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:
2145
2145
2146
2146
<sample-output>
2147
+
2147
2148
****
2148
2149
****
2149
2150
****
2150
2151
****
2152
+
2151
2153
</sample-output>
2152
2154
2153
2155
<!-- **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
2168
2170
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:
<!-- Tee metodi `tulostaKolmio(int koko)` joka tulostaa kolmion käyttäen `tulostaTahtia`-metodia. Siis esimerkiksi kutsu `tulostaKolmio(4)` tulostaa seuraavaa: -->
2182
2186
2183
2187
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:
2184
2188
2185
2189
<sample-output>
2190
+
2186
2191
*
2187
2192
**
2188
2193
***
2189
2194
****
2195
+
2190
2196
</sample-output>
2191
2197
2192
2198
</programming-exercise>
@@ -2195,16 +2201,16 @@ Create a method called `printTriangle(int size)` that prints a triangle by using
2195
2201
<!-- <programming-exercise name='Tulostelua Like A Boss (3 osaa)' tmcname='osa02-Osa02_34.TulosteluaLikeABoss'> -->
2196
2202
2197
2203
2198
-
<programming-exercisename='Printing Like A Boss (3 parts)'tmcname='osa02-Osa02_34.TulosteluaLikeABoss'>
<!-- Tee metodi `tulostaTyhjaa(int maara)` joka tulostaa `maara` kappaletta välilyöntejä. Metodi ei tulosta rivinvaihtoa. -->
2206
2212
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.
2208
2214
2209
2215
<!-- 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. -->
2210
2216
@@ -2216,7 +2222,7 @@ You will also have to either copy the `printStars` method your previous answer o
2216
2222
2217
2223
<!-- Tee metodi `tulostaKolmio(int koko)` joka tulostaa kolmion käyttäen `tulostaTyhjaa`- ja `tulostaTahtia`-metodeja. Siis esimerkiksi kutsu `tulostaKolmio(4)` tulostaa seuraavaa: -->
2218
2224
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:
2220
2226
2221
2227
<sample-output>
2222
2228
*
@@ -2232,7 +2238,7 @@ Create a method called `printTriangle(int size)` that uses `printEmpty` and `pri
2232
2238
2233
2239
<!-- 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` -->
2234
2240
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`.
2236
2242
2237
2243
<!-- Esimerkiksi kutsu `jouluKuusi(4)` tulostaa seuraavaa: -->
2238
2244
@@ -2270,7 +2276,7 @@ The call `christmasTree(10)` should print:
2270
2276
2271
2277
<!-- **Huom:** korkeuksien jotka ovat alle 3 ei tarvitse toimia! -->
2272
2278
2273
-
**N.B.:**lengths shorter that 3 don't have work correctly!
2279
+
**N.B.:**heights shorter that 3 don't have work correctly!
0 commit comments