Add project files.

This commit is contained in:
Csaba Fölker
2022-06-07 19:23:34 +02:00
parent cb44fd97c2
commit 736c6e9646
5 changed files with 126 additions and 0 deletions

8
Bankos/Bankos.csproj Normal file
View File

@@ -0,0 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
</Project>

42
Bankos/Program.cs Normal file
View File

@@ -0,0 +1,42 @@
using System;
namespace Bankos
{
class Program
{
static void Main(string[] args)
{
BankAdat ba = new BankAdat("Kiss Péter", 1000);
ba.Kivet(500);
Console.WriteLine(ba.getEgyenleg());
}
}
public class BankAdat {
private string nev;
private int egyenleg;
public BankAdat(string benev, int egyen) {
nev = benev;
egyenleg = egyen;
}
public int getEgyenleg() {
return egyenleg;
}
public void Kivet(int osszeg)
{
if (osszeg > egyenleg)
{
throw new ArgumentOutOfRangeException("osszeg");
}
if (osszeg < 0) {
throw new ArgumentOutOfRangeException("osszeg");
}
egyenleg -= osszeg;
}
}
}