diff --git a/demopohjat/demo10/.idea/.idea.demo10/.idea/.gitignore b/demopohjat/demo10/.idea/.idea.demo10/.idea/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..b5097354bae146559357993cbb4a9a2624f8b16a --- /dev/null +++ b/demopohjat/demo10/.idea/.idea.demo10/.idea/.gitignore @@ -0,0 +1,13 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Rider ignored files +/projectSettingsUpdater.xml +/contentModel.xml +/.idea.demo10.iml +/modules.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/demopohjat/demo10/.idea/.idea.demo10/.idea/encodings.xml b/demopohjat/demo10/.idea/.idea.demo10/.idea/encodings.xml new file mode 100644 index 0000000000000000000000000000000000000000..df87cf951fb4858ab7a76b68dd479c98b2df2404 --- /dev/null +++ b/demopohjat/demo10/.idea/.idea.demo10/.idea/encodings.xml @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="Encoding" addBOMForNewFiles="with BOM under Windows, with no BOM otherwise" /> +</project> \ No newline at end of file diff --git a/demopohjat/demo10/.idea/.idea.demo10/.idea/indexLayout.xml b/demopohjat/demo10/.idea/.idea.demo10/.idea/indexLayout.xml new file mode 100644 index 0000000000000000000000000000000000000000..7b08163cebc50fb3e777eea4881b68fcebc10590 --- /dev/null +++ b/demopohjat/demo10/.idea/.idea.demo10/.idea/indexLayout.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="UserContentModel"> + <attachedFolders /> + <explicitIncludes /> + <explicitExcludes /> + </component> +</project> \ No newline at end of file diff --git a/demopohjat/demo10/.idea/.idea.demo10/.idea/vcs.xml b/demopohjat/demo10/.idea/.idea.demo10/.idea/vcs.xml new file mode 100644 index 0000000000000000000000000000000000000000..b2bdec2d71b6a5ce4ae49efc37516809c50e4d5e --- /dev/null +++ b/demopohjat/demo10/.idea/.idea.demo10/.idea/vcs.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="VcsDirectoryMappings"> + <mapping directory="$PROJECT_DIR$/../.." vcs="Git" /> + </component> +</project> \ No newline at end of file diff --git a/demopohjat/demo10/PPTeht1A/Taulukointia.cs b/demopohjat/demo10/PPTeht1A/Taulukointia.cs index 2f160ed6c6d9adcbdd335636fe033d06c67cec64..871abd0cebac84c83e31466cd963d352a7424c37 100644 --- a/demopohjat/demo10/PPTeht1A/Taulukointia.cs +++ b/demopohjat/demo10/PPTeht1A/Taulukointia.cs @@ -1,7 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; /// @author: Simo Haatainen /// @version: 08.11.2011 @@ -30,7 +27,7 @@ public class Taulukointia /// <summary> /// Täyttää taulukon parillisilla kokonaisluvuilla alkaen luvusta 2 /// </summary> - /// <param name="taulukko">Täytettävä taulukko</param> + /// <param name="kokonaisLuvut">Täytettävä taulukko</param> /// <example> /// <pre name="test"> /// int[] kokonaisLuvut = new int[8]; diff --git a/demopohjat/demo10/PPTeht1B/Laskuharjoituksia.cs b/demopohjat/demo10/PPTeht1B/Laskuharjoituksia.cs index 6b4308d4a0d73aac55f1cc98442b61f3a8d8a5f0..4d379f8c77dafbcd37612920a3db72bbeb09e962 100644 --- a/demopohjat/demo10/PPTeht1B/Laskuharjoituksia.cs +++ b/demopohjat/demo10/PPTeht1B/Laskuharjoituksia.cs @@ -1,7 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; /// @author: Simo Haatainen /// @version: 08.11.2011 diff --git a/demopohjat/demo10/PPTeht2B/Matka.cs b/demopohjat/demo10/PPTeht2B/Matka.cs index 8524dcae66bd424a707a94930c0ace9f48719051..45d6173297043c1b944a58fa9081759fa132c60e 100644 --- a/demopohjat/demo10/PPTeht2B/Matka.cs +++ b/demopohjat/demo10/PPTeht2B/Matka.cs @@ -1,7 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; /// @author: Simo Haatainen /// @version: 08.11.2011 diff --git a/demopohjat/demo10/PuuRekursio/PuuRekursio.cs b/demopohjat/demo10/PuuRekursio/PuuRekursio.cs index 6aea15d10e192106858f488edd4b815dc2509577..055f92aba4e24097b6619df8540c4d5dea5ada4a 100644 --- a/demopohjat/demo10/PuuRekursio/PuuRekursio.cs +++ b/demopohjat/demo10/PuuRekursio/PuuRekursio.cs @@ -1,70 +1,69 @@ using System; -namespace Demo10 +namespace Demo10; + +public class PuuRekursio { - class PuuRekursio + // Binääripuun solmu. + public class Solmu { - // Binääripuun solmu. - public class Solmu + public readonly int data; + public Solmu vasenLapsi, oikeaLapsi; + + // Konstruktori, jolle voidaan antaa solmun alkio. + public Solmu(int data, Solmu vasen = null, Solmu oikea = null) { - public int data; - public Solmu vasenLapsi, oikeaLapsi; - - // Konstruktori, jolle voidaan antaa solmun alkio. - public Solmu(int data, Solmu vasen = null, Solmu oikea = null) - { - this.data = data; - this.vasenLapsi = vasen; - this.oikeaLapsi = oikea; - } - - // Tulostaa solmun syvyyden mukaan. - public void Tulosta(int syvyys, int valin_lisays) - { - for (int i = valin_lisays; i < syvyys; i++) - Console.Write(" "); - - Console.Write(data + "\n"); - } - }; - - - /// BYCODEBEGIN - static void TulostaPuu(Solmu solmu, int syvyys) + this.data = data; + this.vasenLapsi = vasen; + this.oikeaLapsi = oikea; + } + + // Tulostaa solmun syvyyden mukaan. + public void Tulosta(int syvyys, int valin_lisays) { - // Määritetään väli solmujen välillä. - int valin_lisays = 5; - syvyys += valin_lisays; + for (int i = valin_lisays; i < syvyys; i++) + Console.Write(" "); - // Kirjoita tähän rekursion lopetusehto. - // ... + Console.Write(data + "\n"); + } + }; - // Käsittele tässä oikeanpuoleinen lapsisolmu rekursiivisesti. - // ... - // Tulostaa solmun. - solmu.Tulosta(syvyys, valin_lisays); + /// BYCODEBEGIN + static void TulostaPuu(Solmu solmu, int syvyys) + { + // Määritetään väli solmujen välillä. + int valin_lisays = 5; + syvyys += valin_lisays; - // Käsittele tässä vasemmanpuoleinen lapsisolmu rekursiivisesti. - // ... - } - /// BYCODEEND + // Kirjoita tähän rekursion lopetusehto. + // ... + // Käsittele tässä oikeanpuoleinen lapsisolmu rekursiivisesti. + // ... - // Pääohjelma, jossa luodaan puun solmut ja aloitetaan tulostaminen. - public static void Main(String[] args) - { - Solmu s2 = new Solmu(2, new Solmu(1), new Solmu(3)); - Solmu s6 = new Solmu(6, new Solmu(5), new Solmu(7)); - Solmu s10 = new Solmu(10, new Solmu(9), new Solmu(11)); - Solmu s14 = new Solmu(14, new Solmu(13), new Solmu(15)); + // Tulostaa solmun. + solmu.Tulosta(syvyys, valin_lisays); - Solmu s4 = new Solmu(4, s2, s6); - Solmu s12 = new Solmu(12, s10, s14); + // Käsittele tässä vasemmanpuoleinen lapsisolmu rekursiivisesti. + // ... + } + /// BYCODEEND - Solmu s8 = new Solmu(8, s4, s12); - TulostaPuu(s8, 0); - } + // Pääohjelma, jossa luodaan puun solmut ja aloitetaan tulostaminen. + public static void Main(String[] args) + { + Solmu s2 = new Solmu(2, new Solmu(1), new Solmu(3)); + Solmu s6 = new Solmu(6, new Solmu(5), new Solmu(7)); + Solmu s10 = new Solmu(10, new Solmu(9), new Solmu(11)); + Solmu s14 = new Solmu(14, new Solmu(13), new Solmu(15)); + + Solmu s4 = new Solmu(4, s2, s6); + Solmu s12 = new Solmu(12, s10, s14); + + Solmu s8 = new Solmu(8, s4, s12); + + TulostaPuu(s8, 0); } -} +} \ No newline at end of file diff --git a/demopohjat/demo11/.idea/.idea.demo11/.idea/.gitignore b/demopohjat/demo11/.idea/.idea.demo11/.idea/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..c742159e087a5f468148c106a532e037ee4bd1e8 --- /dev/null +++ b/demopohjat/demo11/.idea/.idea.demo11/.idea/.gitignore @@ -0,0 +1,13 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Rider ignored files +/.idea.demo11.iml +/modules.xml +/contentModel.xml +/projectSettingsUpdater.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/demopohjat/demo11/.idea/.idea.demo11/.idea/encodings.xml b/demopohjat/demo11/.idea/.idea.demo11/.idea/encodings.xml new file mode 100644 index 0000000000000000000000000000000000000000..df87cf951fb4858ab7a76b68dd479c98b2df2404 --- /dev/null +++ b/demopohjat/demo11/.idea/.idea.demo11/.idea/encodings.xml @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="Encoding" addBOMForNewFiles="with BOM under Windows, with no BOM otherwise" /> +</project> \ No newline at end of file diff --git a/demopohjat/demo11/.idea/.idea.demo11/.idea/indexLayout.xml b/demopohjat/demo11/.idea/.idea.demo11/.idea/indexLayout.xml new file mode 100644 index 0000000000000000000000000000000000000000..7b08163cebc50fb3e777eea4881b68fcebc10590 --- /dev/null +++ b/demopohjat/demo11/.idea/.idea.demo11/.idea/indexLayout.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="UserContentModel"> + <attachedFolders /> + <explicitIncludes /> + <explicitExcludes /> + </component> +</project> \ No newline at end of file diff --git a/demopohjat/demo11/.idea/.idea.demo11/.idea/vcs.xml b/demopohjat/demo11/.idea/.idea.demo11/.idea/vcs.xml new file mode 100644 index 0000000000000000000000000000000000000000..b2bdec2d71b6a5ce4ae49efc37516809c50e4d5e --- /dev/null +++ b/demopohjat/demo11/.idea/.idea.demo11/.idea/vcs.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="VcsDirectoryMappings"> + <mapping directory="$PROJECT_DIR$/../.." vcs="Git" /> + </component> +</project> \ No newline at end of file diff --git a/demopohjat/demo11/PPTeht1/Taulukointia.cs b/demopohjat/demo11/PPTeht1/Taulukointia.cs index db7f101798eab25910cd44810d6de51a4fa4e067..110c668e8685777f6b72a8e54f5ed30e9daebc62 100644 --- a/demopohjat/demo11/PPTeht1/Taulukointia.cs +++ b/demopohjat/demo11/PPTeht1/Taulukointia.cs @@ -1,44 +1,40 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -namespace PPTeht2 +namespace PPTeht2; + +/// @author: Simo Haatainen +/// @version: 14.11.2011 +/// <summary> +/// Täytetään taulukoita +/// </summary> +public class Taulukointia { - /// @author: Simo Haatainen - /// @version: 14.11.2011 - /// <summary> - /// Täytetään taulukoita - /// </summary> - public class Taulukointia + public static void Main(string[] args) { - public static void Main(string[] args) - { - int[] kokonaislukuTaulukko = new int[22]; - - TaytaTaulukko(kokonaislukuTaulukko); + int[] kokonaislukuTaulukko = new int[22]; - for (int i = 0; i < kokonaislukuTaulukko.Length; i++) - { - Console.WriteLine("Taulukon paikassa " + i + " on luku " + kokonaislukuTaulukko[i]); - } - } + TaytaTaulukko(kokonaislukuTaulukko); - /// <summary> - /// Täyttää taulukon parillisilla kokonaisluvuilla alkaen luvusta 2 - /// </summary> - /// <param name="taulukko">Täytettävä taulukko</param> - /// <example> - /// <pre name="test"> - /// int[] kokonaisLuvut = new int[8]; - /// TaytaTaulukko(kokonaisLuvut); - /// String.Join(" ",kokonaisLuvut) === "1 3 5 7 9 11 13 15"; - /// </pre> - /// </example> - public static void TaytaTaulukko(int[] kokonaisLuvut) + for (int i = 0; i < kokonaislukuTaulukko.Length; i++) { - // Täytä tähän aliohjelma logiikka + Console.WriteLine("Taulukon paikassa " + i + " on luku " + kokonaislukuTaulukko[i]); } + } + /// <summary> + /// Täyttää taulukon parillisilla kokonaisluvuilla alkaen luvusta 2 + /// </summary> + /// <param name="kokonaisLuvut">Täytettävä taulukko</param> + /// <example> + /// <pre name="test"> + /// int[] kokonaisLuvut = new int[8]; + /// TaytaTaulukko(kokonaisLuvut); + /// String.Join(" ",kokonaisLuvut) === "1 3 5 7 9 11 13 15"; + /// </pre> + /// </example> + public static void TaytaTaulukko(int[] kokonaisLuvut) + { + // Täytä tähän aliohjelma logiikka } -} + +} \ No newline at end of file diff --git a/demopohjat/demo11/PPTeht2/Testausta.cs b/demopohjat/demo11/PPTeht2/Testausta.cs index d5fea27290b018cf87edd3dfca578939bd078f29..7882fbef04f0eb5e6d30486304b2314e6353ea76 100644 --- a/demopohjat/demo11/PPTeht2/Testausta.cs +++ b/demopohjat/demo11/PPTeht2/Testausta.cs @@ -1,41 +1,35 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; +namespace PPTeht2; -namespace PPTeht2 +/// @author: Simo Haatainen +/// @version: 14.11.2011 +/// +/// <summary> +/// Testailua +/// </summary> +public class Testausta { - /// @author: Simo Haatainen - /// @version: 14.11.2011 - /// - /// <summary> - /// Testailua - /// </summary> - public class Testausta + public static void Main(string[] args) { - public static void Main(string[] args) - { - } + } - /// <summary> - /// Palauttaa luvun joka on lähinnä kaikkia annettuja kokonaislukuja (ts. keskiarvo) - /// </summary> - /// <param name="luku1">1. luku</param> - /// <param name="luku2">2. luku</param> - /// <param name="luku3">3. luku</param> - /// <param name="luku4">4. luku</param> - /// <returns>Luku, joka on lähinnä kaikkia lukuja</returns> - /// <example> - /// <pre name="test"> - /// LahinLuku(4,4,4,4) ~~~ 4; - /// LahinLuku(1,2,3,4) ~~~ 2.5; - /// LahinLuku(56, 12, 36, 55) ~~~ 39.75; - /// </pre> - /// </example> - public static double LahinLuku(int luku1, int luku2, int luku3, int luku4) - { - return 0; - } + /// <summary> + /// Palauttaa luvun joka on lähinnä kaikkia annettuja kokonaislukuja (ts. keskiarvo) + /// </summary> + /// <param name="luku1">1. luku</param> + /// <param name="luku2">2. luku</param> + /// <param name="luku3">3. luku</param> + /// <param name="luku4">4. luku</param> + /// <returns>Luku, joka on lähinnä kaikkia lukuja</returns> + /// <example> + /// <pre name="test"> + /// LahinLuku(4,4,4,4) ~~~ 4; + /// LahinLuku(1,2,3,4) ~~~ 2.5; + /// LahinLuku(56, 12, 36, 55) ~~~ 39.75; + /// </pre> + /// </example> + public static double LahinLuku(int luku1, int luku2, int luku3, int luku4) + { + return 0; } -} +} \ No newline at end of file diff --git a/demopohjat/demo11/PPTeht2b/Aliohjelmia.cs b/demopohjat/demo11/PPTeht2b/Aliohjelmia.cs index 990731b88371950597e7a19846c64a1228ea3c71..cc77da01860d94b1fc7a522f0c4c086755a6ece6 100644 --- a/demopohjat/demo11/PPTeht2b/Aliohjelmia.cs +++ b/demopohjat/demo11/PPTeht2b/Aliohjelmia.cs @@ -1,71 +1,66 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; +namespace PPTeht2; -namespace PPTeht2 +/// @author: Simo Haatainen +/// @version: 14.11.2011 +/// +/// <summary> +/// Käytellään aliohjelmia +/// </summary> +public class Aliohjelmia { - /// @author: Simo Haatainen - /// @version: 14.11.2011 - /// - /// <summary> - /// Käytellään aliohjelmia - /// </summary> - public class Aliohjelmia + public static void Main(string[] args) { - public static void Main(string[] args) - { - /* - double nelio = // Laske tähän luvun 4 neliö käyttäen Math.Pow-metodia + /* + double nelio = // Laske tähän luvun 4 neliö käyttäen Math.Pow-metodia + + double nelioJuuri = // Laske tähän luvun 169 neliöjuuri käyttäen Math.Sqrt-metodia - double nelioJuuri = // Laske tähän luvun 169 neliöjuuri käyttäen Math.Sqrt-metodia + double tulojenSumma = // Laske tähän lukujen 4 ja 5 tulon sekä lukujen 6 ja 7 tulon summa käyttäen TulojenSumma-aliohjelmaa - double tulojenSumma = // Laske tähän lukujen 4 ja 5 tulon sekä lukujen 6 ja 7 tulon summa käyttäen TulojenSumma-aliohjelmaa + double valiTulos = // Laske tähän yllä olevilla muuttujilla neliön ja neliöJuuren summa kerrottuna tulojenSummalla - double valiTulos = // Laske tähän yllä olevilla muuttujilla neliön ja neliöJuuren summa kerrottuna tulojenSummalla + double itseisArvo = // Laske tähän valiTuloksen itseisarvo käyttäen Math.Abs-metodia - double itseisArvo = // Laske tähän valiTuloksen itseisarvo käyttäen Math.Abs-metodia - - StringBuilder merkkijono = new StringBuilder(); - - merkkijono = // Lisää merkkijonoon " ois mukavaa" käyttämällä merkkijono.Append-metodia + StringBuilder merkkijono = new StringBuilder(); - bool jaollinenKahdella = // Tarkista tässä onko luku 4*5*6-23 jaollinen kahdella käyttäen JaollinenKahdella-aliohjelmaa - */ - } + merkkijono = // Lisää merkkijonoon " ois mukavaa" käyttämällä merkkijono.Append-metodia - /// <summary> - /// Laskee ja palauttaa kahden ensimmäisen luvun tulon ja kahden jälkimmäisen tulon summan - /// </summary> - /// <param name="luku1">1. luku</param> - /// <param name="luku2">2. luku</param> - /// <param name="luku3">3. luku</param> - /// <param name="luku4">4. luku</param> - /// <returns>1. ja 2. luvun tulon ja 3. ja 4. luvun tulon summa</returns> - /// <pre name="test"> - /// TulojenSumma(1,2,3,4) ~~~ 14; - /// </pre> - /// </example> - public static double TulojenSumma(int luku1, int luku2, int luku3, int luku4) - { - return 0; - } + bool jaollinenKahdella = // Tarkista tässä onko luku 4*5*6-23 jaollinen kahdella käyttäen JaollinenKahdella-aliohjelmaa + */ + } + + /// <summary> + /// Laskee ja palauttaa kahden ensimmäisen luvun tulon ja kahden jälkimmäisen tulon summan + /// </summary> + /// <param name="luku1">1. luku</param> + /// <param name="luku2">2. luku</param> + /// <param name="luku3">3. luku</param> + /// <param name="luku4">4. luku</param> + /// <returns>1. ja 2. luvun tulon ja 3. ja 4. luvun tulon summa</returns> + /// <example> + /// <pre name="test"> + /// TulojenSumma(1,2,3,4) ~~~ 14; + /// </pre> + /// </example> + public static double TulojenSumma(int luku1, int luku2, int luku3, int luku4) + { + return 0; + } - /// <summary> - /// Palauttaa onko annettu luku jaollinen kahdella - /// </summary> - /// <param name="luku">Tarkistettava luku</param> - /// <returns>Onko annettu luku jaollinen kahdella</returns> - /// <example> - /// <pre name="test"> - /// JaollinenKahdella(0) === true; - /// JaollinenKahdella(1) === false; - /// JaollinenKahdella(2) === true; - /// </pre> - /// </example> - public static bool JaollinenKahdella(int luku) - { - return false; - } + /// <summary> + /// Palauttaa onko annettu luku jaollinen kahdella + /// </summary> + /// <param name="luku">Tarkistettava luku</param> + /// <returns>Onko annettu luku jaollinen kahdella</returns> + /// <example> + /// <pre name="test"> + /// JaollinenKahdella(0) === true; + /// JaollinenKahdella(1) === false; + /// JaollinenKahdella(2) === true; + /// </pre> + /// </example> + public static bool JaollinenKahdella(int luku) + { + return false; } -} +} \ No newline at end of file diff --git a/demopohjat/demo11/Robot/Robot.cs b/demopohjat/demo11/Robot/Robot.cs index 44b9a83c216a4ae7c87958dd7e1863172c7547ce..1cf6061b2598073c5e8c71889a12e8ffdc5b15b1 100644 --- a/demopohjat/demo11/Robot/Robot.cs +++ b/demopohjat/demo11/Robot/Robot.cs @@ -1,8 +1,6 @@ using System; -using System.Text; -using System.Linq; -using System.Collections.Generic; +// ReSharper disable RedundantDefaultMemberInitializer /// @author vesal /// @version 17.11.2013 /// <summary> @@ -141,6 +139,6 @@ public class RobotCommander /// </example> public override string ToString() { - return String.Format("{0,3}: ({1},{2}) {3,-5}", siirtoja, x, y, kiinni); + return $"{siirtoja,3}: ({x},{y}) {kiinni,-5}"; } } \ No newline at end of file diff --git a/demopohjat/demo4/.idea/.idea.demo4/.idea/.gitignore b/demopohjat/demo4/.idea/.idea.demo4/.idea/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..0bb745349f6de25fc935bbb22595cb2949deed3f --- /dev/null +++ b/demopohjat/demo4/.idea/.idea.demo4/.idea/.gitignore @@ -0,0 +1,13 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Rider ignored files +/contentModel.xml +/.idea.demo4.iml +/modules.xml +/projectSettingsUpdater.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/demopohjat/demo4/.idea/.idea.demo4/.idea/encodings.xml b/demopohjat/demo4/.idea/.idea.demo4/.idea/encodings.xml new file mode 100644 index 0000000000000000000000000000000000000000..df87cf951fb4858ab7a76b68dd479c98b2df2404 --- /dev/null +++ b/demopohjat/demo4/.idea/.idea.demo4/.idea/encodings.xml @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="Encoding" addBOMForNewFiles="with BOM under Windows, with no BOM otherwise" /> +</project> \ No newline at end of file diff --git a/demopohjat/demo4/.idea/.idea.demo4/.idea/indexLayout.xml b/demopohjat/demo4/.idea/.idea.demo4/.idea/indexLayout.xml new file mode 100644 index 0000000000000000000000000000000000000000..7b08163cebc50fb3e777eea4881b68fcebc10590 --- /dev/null +++ b/demopohjat/demo4/.idea/.idea.demo4/.idea/indexLayout.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="UserContentModel"> + <attachedFolders /> + <explicitIncludes /> + <explicitExcludes /> + </component> +</project> \ No newline at end of file diff --git a/demopohjat/demo4/.idea/.idea.demo4/.idea/vcs.xml b/demopohjat/demo4/.idea/.idea.demo4/.idea/vcs.xml new file mode 100644 index 0000000000000000000000000000000000000000..b2bdec2d71b6a5ce4ae49efc37516809c50e4d5e --- /dev/null +++ b/demopohjat/demo4/.idea/.idea.demo4/.idea/vcs.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="VcsDirectoryMappings"> + <mapping directory="$PROJECT_DIR$/../.." vcs="Git" /> + </component> +</project> \ No newline at end of file diff --git a/demopohjat/demo4/Tauno4/Tauno4.cs b/demopohjat/demo4/Tauno4/Tauno4.cs index 262a1f1b552c73e8a30bd328c1d1d787be422e44..d1d26d8d5dd722036a637ecafda3d713dfe84302 100644 --- a/demopohjat/demo4/Tauno4/Tauno4.cs +++ b/demopohjat/demo4/Tauno4/Tauno4.cs @@ -1,7 +1,4 @@ using System; -using System.Text; -using System.Linq; -using System.Collections.Generic; /// @author vesal /// @version 29.9.2013 @@ -74,6 +71,7 @@ public class Tauno4 } + // ReSharper disable once ForCanBeConvertedToForeach /// <summary> /// Laskee yhteen taulukon alkiot /// </summary> diff --git a/demopohjat/demo5/.idea/.idea.demo5/.idea/.gitignore b/demopohjat/demo5/.idea/.idea.demo5/.idea/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..55970188c9dad8ecba2ba8a313fca65784344570 --- /dev/null +++ b/demopohjat/demo5/.idea/.idea.demo5/.idea/.gitignore @@ -0,0 +1,13 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Rider ignored files +/contentModel.xml +/.idea.demo5.iml +/projectSettingsUpdater.xml +/modules.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/demopohjat/demo5/.idea/.idea.demo5/.idea/encodings.xml b/demopohjat/demo5/.idea/.idea.demo5/.idea/encodings.xml new file mode 100644 index 0000000000000000000000000000000000000000..df87cf951fb4858ab7a76b68dd479c98b2df2404 --- /dev/null +++ b/demopohjat/demo5/.idea/.idea.demo5/.idea/encodings.xml @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="Encoding" addBOMForNewFiles="with BOM under Windows, with no BOM otherwise" /> +</project> \ No newline at end of file diff --git a/demopohjat/demo5/.idea/.idea.demo5/.idea/indexLayout.xml b/demopohjat/demo5/.idea/.idea.demo5/.idea/indexLayout.xml new file mode 100644 index 0000000000000000000000000000000000000000..7b08163cebc50fb3e777eea4881b68fcebc10590 --- /dev/null +++ b/demopohjat/demo5/.idea/.idea.demo5/.idea/indexLayout.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="UserContentModel"> + <attachedFolders /> + <explicitIncludes /> + <explicitExcludes /> + </component> +</project> \ No newline at end of file diff --git a/demopohjat/demo5/.idea/.idea.demo5/.idea/vcs.xml b/demopohjat/demo5/.idea/.idea.demo5/.idea/vcs.xml new file mode 100644 index 0000000000000000000000000000000000000000..b2bdec2d71b6a5ce4ae49efc37516809c50e4d5e --- /dev/null +++ b/demopohjat/demo5/.idea/.idea.demo5/.idea/vcs.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="VcsDirectoryMappings"> + <mapping directory="$PROJECT_DIR$/../.." vcs="Git" /> + </component> +</project> \ No newline at end of file diff --git a/demopohjat/demo5/Tauno5/Tauno5.cs b/demopohjat/demo5/Tauno5/Tauno5.cs index b75a5c5d1e70ef62cc83f1e7340b75192e8dabcc..7c72319a68a7d88920280f3f45d704b0b1175e5e 100644 --- a/demopohjat/demo5/Tauno5/Tauno5.cs +++ b/demopohjat/demo5/Tauno5/Tauno5.cs @@ -1,7 +1,4 @@ using System; -using System.Text; -using System.Linq; -using System.Collections.Generic; /// @author vesal /// @version 6.10.2013 @@ -40,7 +37,7 @@ public class Tauno5 /// </example> public static void LisaaJuokseva(int[] t) { - /// TODO: Kopioi tähän Taunossa tekemäsi koodi + // TODO: Kopioi tähän Taunossa tekemäsi koodi } } diff --git a/demopohjat/demo6/.idea/.idea.demo6/.idea/.gitignore b/demopohjat/demo6/.idea/.idea.demo6/.idea/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..1c0eca11782e8b59083730572f3c1cf876f944a1 --- /dev/null +++ b/demopohjat/demo6/.idea/.idea.demo6/.idea/.gitignore @@ -0,0 +1,13 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Rider ignored files +/contentModel.xml +/projectSettingsUpdater.xml +/modules.xml +/.idea.demo6.iml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/demopohjat/demo6/.idea/.idea.demo6/.idea/encodings.xml b/demopohjat/demo6/.idea/.idea.demo6/.idea/encodings.xml new file mode 100644 index 0000000000000000000000000000000000000000..df87cf951fb4858ab7a76b68dd479c98b2df2404 --- /dev/null +++ b/demopohjat/demo6/.idea/.idea.demo6/.idea/encodings.xml @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="Encoding" addBOMForNewFiles="with BOM under Windows, with no BOM otherwise" /> +</project> \ No newline at end of file diff --git a/demopohjat/demo6/.idea/.idea.demo6/.idea/indexLayout.xml b/demopohjat/demo6/.idea/.idea.demo6/.idea/indexLayout.xml new file mode 100644 index 0000000000000000000000000000000000000000..7b08163cebc50fb3e777eea4881b68fcebc10590 --- /dev/null +++ b/demopohjat/demo6/.idea/.idea.demo6/.idea/indexLayout.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="UserContentModel"> + <attachedFolders /> + <explicitIncludes /> + <explicitExcludes /> + </component> +</project> \ No newline at end of file diff --git a/demopohjat/demo6/.idea/.idea.demo6/.idea/vcs.xml b/demopohjat/demo6/.idea/.idea.demo6/.idea/vcs.xml new file mode 100644 index 0000000000000000000000000000000000000000..b2bdec2d71b6a5ce4ae49efc37516809c50e4d5e --- /dev/null +++ b/demopohjat/demo6/.idea/.idea.demo6/.idea/vcs.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="VcsDirectoryMappings"> + <mapping directory="$PROJECT_DIR$/../.." vcs="Git" /> + </component> +</project> \ No newline at end of file diff --git a/demopohjat/demo6/Tauno6/Tauno6.cs b/demopohjat/demo6/Tauno6/Tauno6.cs index a1b08b43e3136f7e818638544037c7a71792bc19..cb92976c1473f0872e3adddc57be951363995239 100644 --- a/demopohjat/demo6/Tauno6/Tauno6.cs +++ b/demopohjat/demo6/Tauno6/Tauno6.cs @@ -1,7 +1,4 @@ using System; -using System.Text; -using System.Linq; -using System.Collections.Generic; /// @author vesal /// @version 15.10.2013 @@ -36,7 +33,7 @@ public class Tauno6 /// </example> public static void KaannaTaulukko(int[] t) { - /// TODO: Kopioi tähän Taunossa tekemäsi koodi + // TODO: Kopioi tähän Taunossa tekemäsi koodi } /// <summary> @@ -52,6 +49,6 @@ public class Tauno6 /// </example> public static void VaihdaJokaToinen(int[] t) { - /// TODO: Kopioi tähän Taunossa tekemäsi koodi + // TODO: Kopioi tähän Taunossa tekemäsi koodi } } \ No newline at end of file diff --git a/demopohjat/demo8/Pisteet2/Pisteet2.cs b/demopohjat/demo8/Pisteet2/Pisteet2.cs index b5d6f3876646ea3c34ce5faf83fd2770fb2d3ce9..4a454c6d8cf130893e8336e26795d13c6b330c26 100644 --- a/demopohjat/demo8/Pisteet2/Pisteet2.cs +++ b/demopohjat/demo8/Pisteet2/Pisteet2.cs @@ -126,9 +126,9 @@ namespace MinJypeli /// </summary> public class Piste { - private Vector vektori; - public String nimi = ""; - public String vari = ""; + private readonly Vector vektori; + public string nimi = ""; + public string vari = ""; /// <summary> @@ -186,7 +186,7 @@ namespace MinJypeli /// </summary> public static class RandomGen { - private static Random rand = new Random(); + private static readonly Random rand = new Random(); /// <summary> /// Palauttaa satunnaisen liukuluvun parametrien <code>min</code> ja <code>max</code> väliltä. @@ -214,7 +214,7 @@ namespace MinJypeli } } - public struct Vector + public readonly struct Vector { /// <summary> /// Nollavektori. @@ -233,24 +233,18 @@ namespace MinJypeli return Math.Sqrt((x * x + y * y)); } - public double X; - public double Y; + public readonly double X; + public readonly double Y; /// <summary> /// Vektorin pituus. /// </summary> - public double Magnitude - { - get { return Math.Sqrt(MagnitudeSquared); } - } + public double Magnitude => Math.Sqrt(MagnitudeSquared); /// <summary> /// Vektorin pituuden neliö. /// </summary> - public double MagnitudeSquared - { - get { return X * X + Y * Y; } - } + public double MagnitudeSquared => X * X + Y * Y; /// <summary> /// Luo uuden vektorin komponenteista. @@ -270,7 +264,7 @@ namespace MinJypeli /// <returns>lukupari merkkijonona</returns> public override string ToString() { - return String.Format("({0:0.0},{1:0.0})", X, Y); + return $"({X:0.0},{Y:0.0})"; }