-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
388e912
commit 4536c66
Showing
54 changed files
with
6,634 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.