Add project files.
This commit is contained in:
8
Bankos/Bankos.csproj
Normal file
8
Bankos/Bankos.csproj
Normal 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
42
Bankos/Program.cs
Normal 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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user