diff --git a/harjoitustyo/.idea/.idea.harjoitustyo/.idea/.gitignore b/harjoitustyo/.idea/.idea.harjoitustyo/.idea/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..bb9f4a08ded28185949d6cc11d62f78b2cc6cc35 --- /dev/null +++ b/harjoitustyo/.idea/.idea.harjoitustyo/.idea/.gitignore @@ -0,0 +1,13 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Rider ignored files +/projectSettingsUpdater.xml +/contentModel.xml +/.idea.harjoitustyo.iml +/modules.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/harjoitustyo/.idea/.idea.harjoitustyo/.idea/indexLayout.xml b/harjoitustyo/.idea/.idea.harjoitustyo/.idea/indexLayout.xml new file mode 100644 index 0000000000000000000000000000000000000000..7b08163cebc50fb3e777eea4881b68fcebc10590 --- /dev/null +++ b/harjoitustyo/.idea/.idea.harjoitustyo/.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/harjoitustyo/harjoitustyo.sln b/harjoitustyo/harjoitustyo.sln new file mode 100644 index 0000000000000000000000000000000000000000..737dbde24d0fe7a08d2ef7ef5803e858da5b4a85 --- /dev/null +++ b/harjoitustyo/harjoitustyo.sln @@ -0,0 +1,16 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "pankkiautomaatti", "pankkiautomaatti\pankkiautomaatti.csproj", "{5F68F6A3-2942-4E05-B7C1-DDB329F75448}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {5F68F6A3-2942-4E05-B7C1-DDB329F75448}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5F68F6A3-2942-4E05-B7C1-DDB329F75448}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5F68F6A3-2942-4E05-B7C1-DDB329F75448}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5F68F6A3-2942-4E05-B7C1-DDB329F75448}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/harjoitustyo/pankkiautomaatti/Pankkiautomaatti.cs b/harjoitustyo/pankkiautomaatti/Pankkiautomaatti.cs new file mode 100644 index 0000000000000000000000000000000000000000..6fe5c5bec9d7d08d88abc885f1afe1d546b6d7f8 --- /dev/null +++ b/harjoitustyo/pankkiautomaatti/Pankkiautomaatti.cs @@ -0,0 +1,93 @@ +using System; +using System.Text; +using System.Linq; +using System.Collections.Generic; + +/// @author Omanimi +/// @version Päivämäärä +/// <summary> +/// +/// </summary> +public class Pankkiautomaatti +{ + /// <summary> + /// + /// </summary> + public static void Main() + { + double saldo = 200.00; + Aloitus(); + PinKoodi(); + Nosto(saldo); + Saldo(); + Tilitapahtumat(30.00); + Lopetus(); + } + + public static void Aloitus() + { + Console.WriteLine("Tervetuloa!"); + Console.WriteLine("Syota kortti ole hyva"); + } + + public static bool PinKoodi() + { + int yritykset = 0; + int pinkoodi = 1234; + Console.Write("Anna pin koodi: "); + int syote = Convert.ToInt32(Console.ReadLine()); + + yritykset++; + if (yritykset <= 3 && syote == 1234) + { + return true; + } + return false; + } + + public static double Nosto(double saldo) + { + Console.WriteLine("Kuinka paljon haluat nostaa"); + double nosto = Convert.ToDouble(Console.ReadLine()); + + if (saldo > 0.00 && nosto < saldo) + { + saldo = saldo - nosto; + Tilitapahtumat(nosto); + Saldo(); + } + else + { + Console.WriteLine("Tilillä ei ole katetta"); + } + return saldo; + } + + public static double Saldo() + { + return 200.00; + } + + public static void Tilitapahtumat(double luku) + { + double[] taulu = new double[20]; + for (int i = 0; i < taulu.Length; i++) + { + taulu[i] = 0; + } + taulu.Append(luku); + for (int k = 0; k < taulu.Length; k++) + { + if (taulu[k] != 0) + { + Console.WriteLine(taulu[k]); + } + } + } + + public static void Lopetus() + { + Console.WriteLine("Kiitos kaynnista"); + Console.WriteLine("Tervetuloa uudelleen"); + } +} \ No newline at end of file diff --git a/harjoitustyo/pankkiautomaatti/pankkiautomaatti.csproj b/harjoitustyo/pankkiautomaatti/pankkiautomaatti.csproj new file mode 100644 index 0000000000000000000000000000000000000000..7841507631090524480fa9612effe904bdaadcea --- /dev/null +++ b/harjoitustyo/pankkiautomaatti/pankkiautomaatti.csproj @@ -0,0 +1,10 @@ +<Project Sdk="Microsoft.NET.Sdk"> + + <PropertyGroup> + <OutputType>Exe</OutputType> + <TargetFramework>net7.0</TargetFramework> + <ExternalConsole>true</ExternalConsole> + <RootNamespace>main</RootNamespace> + </PropertyGroup> + +</Project>