From 5efe5f601cf48258eaebfb660ff42daf36e4c8d3 Mon Sep 17 00:00:00 2001
From: Vesikukka Teemu <teemu.t.vesikukka@student.jyu.fi>
Date: Sun, 15 Oct 2023 01:23:54 +0300
Subject: [PATCH] Harjoitustyon kooditiedosto

---
 .../.idea/.idea.harjoitustyo/.idea/.gitignore | 13 +++
 .../.idea.harjoitustyo/.idea/indexLayout.xml  |  8 ++
 harjoitustyo/harjoitustyo.sln                 | 16 ++++
 .../pankkiautomaatti/Pankkiautomaatti.cs      | 93 +++++++++++++++++++
 .../pankkiautomaatti/pankkiautomaatti.csproj  | 10 ++
 5 files changed, 140 insertions(+)
 create mode 100644 harjoitustyo/.idea/.idea.harjoitustyo/.idea/.gitignore
 create mode 100644 harjoitustyo/.idea/.idea.harjoitustyo/.idea/indexLayout.xml
 create mode 100644 harjoitustyo/harjoitustyo.sln
 create mode 100644 harjoitustyo/pankkiautomaatti/Pankkiautomaatti.cs
 create mode 100644 harjoitustyo/pankkiautomaatti/pankkiautomaatti.csproj

diff --git a/harjoitustyo/.idea/.idea.harjoitustyo/.idea/.gitignore b/harjoitustyo/.idea/.idea.harjoitustyo/.idea/.gitignore
new file mode 100644
index 0000000..bb9f4a0
--- /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 0000000..7b08163
--- /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 0000000..737dbde
--- /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 0000000..6fe5c5b
--- /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 0000000..7841507
--- /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>
-- 
GitLab