Skip to content

Commit

Permalink
Test1
Browse files Browse the repository at this point in the history
  • Loading branch information
ByteWolf-dev committed Dec 21, 2024
1 parent 388e912 commit 4536c66
Show file tree
Hide file tree
Showing 54 changed files with 6,634 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Bank/.idea/.idea.Bank/.idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions Bank/.idea/.idea.Bank/.idea/discord.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Bank/.idea/.idea.Bank/.idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Bank/.idea/.idea.Bank/.idea/indexLayout.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions Bank/.idea/.idea.Bank/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions Bank/Bank.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bank", "Bank\Bank.csproj", "{3A9A8DB9-AD7E-458B-99B0-C6DED1207D1B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test", "Test\Test.csproj", "{519A5242-9655-4427-91CC-B3F4BCF6D428}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{3A9A8DB9-AD7E-458B-99B0-C6DED1207D1B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3A9A8DB9-AD7E-458B-99B0-C6DED1207D1B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3A9A8DB9-AD7E-458B-99B0-C6DED1207D1B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3A9A8DB9-AD7E-458B-99B0-C6DED1207D1B}.Release|Any CPU.Build.0 = Release|Any CPU
{519A5242-9655-4427-91CC-B3F4BCF6D428}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{519A5242-9655-4427-91CC-B3F4BCF6D428}.Debug|Any CPU.Build.0 = Debug|Any CPU
{519A5242-9655-4427-91CC-B3F4BCF6D428}.Release|Any CPU.ActiveCfg = Release|Any CPU
{519A5242-9655-4427-91CC-B3F4BCF6D428}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
10 changes: 10 additions & 0 deletions Bank/Bank/Bank.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

</Project>
189 changes: 189 additions & 0 deletions Bank/Bank/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,189 @@
using System;
using System.Collections.Generic;

namespace Bank
{
// Represents a bank account
class BankAccount
{
public string AccountNumber { get; }
public string AccountHolder { get; }
private decimal Balance;

public BankAccount(string accountNumber, string accountHolder, decimal initialDeposit)
{
AccountNumber = accountNumber;
AccountHolder = accountHolder;
Balance = initialDeposit;
}

public void Deposit(decimal amount)
{
if (amount > 0)
{
Balance += amount;
Console.WriteLine($"Successfully deposited {amount:C} into account {AccountNumber}.");
}
else
{
Console.WriteLine("Invalid deposit amount. Please enter a positive value.");
}
}

public void Withdraw(decimal amount)
{
if (amount > 0 && amount <= Balance)
{
Balance -= amount;
Console.WriteLine($"Successfully withdrew {amount:C} from account {AccountNumber}.");
}
else
{
Console.WriteLine("Invalid withdrawal amount or insufficient funds.");
}
}

public void DisplayBalance()
{
Console.WriteLine($"Account {AccountNumber} balance: {Balance:C}");
}
}

// Represents the bank system
class Bank
{
private Dictionary<string, BankAccount> accounts = new Dictionary<string, BankAccount>();

public void CreateAccount(string accountNumber, string accountHolder, decimal initialDeposit)
{
if (!accounts.ContainsKey(accountNumber))
{
accounts[accountNumber] = new BankAccount(accountNumber, accountHolder, initialDeposit);
Console.WriteLine($"Account created successfully for {accountHolder} with account number {accountNumber}.");
}
else
{
Console.WriteLine("Account number already exists. Please use a different account number.");
}
}

public void Deposit(string accountNumber, decimal amount)
{
if (accounts.TryGetValue(accountNumber, out var account))
{
account.Deposit(amount);
}
else
{
Console.WriteLine("Account not found.");
}
}

public void Withdraw(string accountNumber, decimal amount)
{
if (accounts.TryGetValue(accountNumber, out var account))
{
account.Withdraw(amount);
}
else
{
Console.WriteLine("Account not found.");
}
}

public void DisplayBalance(string accountNumber)
{
if (accounts.TryGetValue(accountNumber, out var account))
{
account.DisplayBalance();
}
else
{
Console.WriteLine("Account not found.");
}
}
}

// Main program
class Program
{
static void Main(string[] args)
{
Bank bank = new Bank();

while (true)
{
Console.WriteLine("\n--- Bank System Menu ---");
Console.WriteLine("1. Create Account");
Console.WriteLine("2. Deposit");
Console.WriteLine("3. Withdraw");
Console.WriteLine("4. Check Balance");
Console.WriteLine("5. Exit");
Console.Write("Choose an option: ");

string choice = Console.ReadLine();

switch (choice)
{
case "1":
Console.Write("Enter Account Number: ");
string accountNumber = Console.ReadLine();
Console.Write("Enter Account Holder Name: ");
string accountHolder = Console.ReadLine();
Console.Write("Enter Initial Deposit: ");
if (decimal.TryParse(Console.ReadLine(), out decimal initialDeposit))
{
bank.CreateAccount(accountNumber, accountHolder, initialDeposit);
}
else
{
Console.WriteLine("Invalid deposit amount.");
}
break;

case "2":
Console.Write("Enter Account Number: ");
accountNumber = Console.ReadLine();
Console.Write("Enter Deposit Amount: ");
if (decimal.TryParse(Console.ReadLine(), out decimal depositAmount))
{
bank.Deposit(accountNumber, depositAmount);
}
else
{
Console.WriteLine("Invalid deposit amount.");
}
break;

case "3":
Console.Write("Enter Account Number: ");
accountNumber = Console.ReadLine();
Console.Write("Enter Withdrawal Amount: ");
if (decimal.TryParse(Console.ReadLine(), out decimal withdrawAmount))
{
bank.Withdraw(accountNumber, withdrawAmount);
}
else
{
Console.WriteLine("Invalid withdrawal amount.");
}
break;

case "4":
Console.Write("Enter Account Number: ");
accountNumber = Console.ReadLine();
bank.DisplayBalance(accountNumber);
break;

case "5":
Console.WriteLine("Thank you for using the Bank System. Goodbye!");
return;

default:
Console.WriteLine("Invalid option. Please choose a valid menu option.");
break;
}
}
}
}
}
23 changes: 23 additions & 0 deletions Bank/Bank/bin/Debug/net8.0/Bank.deps.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"runtimeTarget": {
"name": ".NETCoreApp,Version=v8.0",
"signature": ""
},
"compilationOptions": {},
"targets": {
".NETCoreApp,Version=v8.0": {
"Bank/1.0.0": {
"runtime": {
"Bank.dll": {}
}
}
}
},
"libraries": {
"Bank/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
}
}
}
Binary file added Bank/Bank/bin/Debug/net8.0/Bank.dll
Binary file not shown.
Binary file added Bank/Bank/bin/Debug/net8.0/Bank.exe
Binary file not shown.
Binary file added Bank/Bank/bin/Debug/net8.0/Bank.pdb
Binary file not shown.
12 changes: 12 additions & 0 deletions Bank/Bank/bin/Debug/net8.0/Bank.runtimeconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"runtimeOptions": {
"tfm": "net8.0",
"framework": {
"name": "Microsoft.NETCore.App",
"version": "8.0.0"
},
"configProperties": {
"System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false
}
}
}
69 changes: 69 additions & 0 deletions Bank/Bank/obj/Bank.csproj.nuget.dgspec.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{
"format": 1,
"restore": {
"C:\\Users\\Peace\\Desktop\\GitHubActionTest\\Bank\\Bank\\Bank.csproj": {}
},
"projects": {
"C:\\Users\\Peace\\Desktop\\GitHubActionTest\\Bank\\Bank\\Bank.csproj": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "C:\\Users\\Peace\\Desktop\\GitHubActionTest\\Bank\\Bank\\Bank.csproj",
"projectName": "Bank",
"projectPath": "C:\\Users\\Peace\\Desktop\\GitHubActionTest\\Bank\\Bank\\Bank.csproj",
"packagesPath": "C:\\Users\\Peace\\.nuget\\packages\\",
"outputPath": "C:\\Users\\Peace\\Desktop\\GitHubActionTest\\Bank\\Bank\\obj\\",
"projectStyle": "PackageReference",
"configFilePaths": [
"C:\\Users\\Peace\\AppData\\Roaming\\NuGet\\NuGet.Config",
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
],
"originalTargetFrameworks": [
"net8.0"
],
"sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"C:\\Program Files\\dotnet\\library-packs": {},
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
"net8.0": {
"targetAlias": "net8.0",
"projectReferences": {}
}
},
"warningProperties": {
"warnAsError": [
"NU1605"
]
},
"restoreAuditProperties": {
"enableAudit": "true",
"auditLevel": "low",
"auditMode": "direct"
}
},
"frameworks": {
"net8.0": {
"targetAlias": "net8.0",
"imports": [
"net461",
"net462",
"net47",
"net471",
"net472",
"net48",
"net481"
],
"assetTargetFallback": true,
"warn": true,
"frameworkReferences": {
"Microsoft.NETCore.App": {
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.403/PortableRuntimeIdentifierGraph.json"
}
}
}
}
}
Loading

0 comments on commit 4536c66

Please sign in to comment.