Initial transfer of larger repo from git. IF full history and branches are needed must go to github at https://github.com/DulcisL/CCUCoding.git
This commit is contained in:
commit
c09ce40be0
4048 files changed
+603256
No files matched your search
@@ -0,0 +1,69 @@
|
||||
namespace Classes;
|
||||
|
||||
public class BankAccount
|
||||
{
|
||||
private static int s_accountNumberSeed = 1234567890;
|
||||
public string Number { get; }
|
||||
public string Owner { get; set; }
|
||||
public decimal Balance
|
||||
{
|
||||
get
|
||||
{
|
||||
decimal balance = 0;
|
||||
foreach (var item in _allTransactions)
|
||||
{
|
||||
balance += item.Amount;
|
||||
}
|
||||
return balance;
|
||||
}
|
||||
}
|
||||
private List<Transaction> _allTransactions = new List<Transaction>();
|
||||
|
||||
public BankAccount(string name, decimal initialBalance)
|
||||
{
|
||||
Number = s_accountNumberSeed.ToString();
|
||||
s_accountNumberSeed++;
|
||||
|
||||
Owner = name;
|
||||
MakeDeposit(initialBalance, DateTime.Now, "Initial balance");
|
||||
}
|
||||
|
||||
public void MakeDeposit(decimal amount, DateTime date, string note)
|
||||
{
|
||||
if (amount <= 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(nameof(amount), "Amount of deposit must be positive");
|
||||
}
|
||||
var deposit = new Transaction(amount, date, note);
|
||||
_allTransactions.Add(deposit);
|
||||
}
|
||||
|
||||
public void MakeWithdrawal(decimal amount, DateTime date, string note)
|
||||
{
|
||||
if (amount <= 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(nameof(amount), "Amount of withdrawal must be positive");
|
||||
}
|
||||
if (Balance - amount < 0)
|
||||
{
|
||||
throw new InvalidOperationException("Not sufficient funds for this withdrawal");
|
||||
}
|
||||
var withdrawal = new Transaction(-amount, date, note);
|
||||
_allTransactions.Add(withdrawal);
|
||||
}
|
||||
|
||||
public string GetAccountHistory()
|
||||
{
|
||||
var report = new System.Text.StringBuilder();
|
||||
|
||||
decimal balance = 0;
|
||||
report.AppendLine("Date\t\tAmount\tBalance\tNote");
|
||||
foreach (var item in _allTransactions)
|
||||
{
|
||||
balance += item.Amount;
|
||||
report.AppendLine($"{item.Date.ToShortDateString()}\t{item.Amount}\t{balance}\t{item.Notes}");
|
||||
}
|
||||
|
||||
return report.ToString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
using Classes;
|
||||
|
||||
var account = new BankAccount("Lakota", 1000);
|
||||
Console.WriteLine($"Account {account.Number} was created for {account.Owner} with {account.Balance} initial balance.");
|
||||
|
||||
account.MakeWithdrawal(500, DateTime.Now, "Rent payment");
|
||||
Console.WriteLine(account.Balance);
|
||||
account.MakeDeposit(100, DateTime.Now, "Friend paid me back");
|
||||
Console.WriteLine(account.Balance);
|
||||
|
||||
/*
|
||||
try
|
||||
{
|
||||
account.MakeWithdrawal(750, DateTime.Now, "Attempt to overdraw");
|
||||
}
|
||||
catch (InvalidOperationException e)
|
||||
{
|
||||
Console.WriteLine("Exception caught trying to overdraw");
|
||||
Console.WriteLine(e.ToString());
|
||||
}
|
||||
|
||||
BankAccount invalidAccount;
|
||||
try
|
||||
{
|
||||
invalidAccount = new BankAccount("invalid", -55);
|
||||
}
|
||||
catch (ArgumentOutOfRangeException e)
|
||||
{
|
||||
Console.WriteLine("Exception caught creating account with negative balance");
|
||||
Console.WriteLine(e.ToString());
|
||||
return;
|
||||
}
|
||||
*/
|
||||
Console.WriteLine(account.GetAccountHistory());
|
||||
|
||||
Console.ReadLine();
|
||||
@@ -0,0 +1,15 @@
|
||||
namespace Classes;
|
||||
|
||||
public class Transaction
|
||||
{
|
||||
public decimal Amount { get; }
|
||||
public DateTime Date { get; }
|
||||
public string Notes { get; }
|
||||
|
||||
public Transaction(decimal amount, DateTime date, string note)
|
||||
{
|
||||
Amount = amount;
|
||||
Date = date;
|
||||
Notes = note;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"runtimeTarget": {
|
||||
"name": ".NETCoreApp,Version=v8.0",
|
||||
"signature": ""
|
||||
},
|
||||
"compilationOptions": {},
|
||||
"targets": {
|
||||
".NETCoreApp,Version=v8.0": {
|
||||
"classes/1.0.0": {
|
||||
"runtime": {
|
||||
"classes.dll": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"libraries": {
|
||||
"classes/1.0.0": {
|
||||
"type": "project",
|
||||
"serviceable": false,
|
||||
"sha512": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"runtimeOptions": {
|
||||
"tfm": "net8.0",
|
||||
"framework": {
|
||||
"name": "Microsoft.NETCore.App",
|
||||
"version": "8.0.0"
|
||||
},
|
||||
"configProperties": {
|
||||
"System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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>
|
||||
@@ -0,0 +1,4 @@
|
||||
// <autogenerated />
|
||||
using System;
|
||||
using System.Reflection;
|
||||
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v8.0", FrameworkDisplayName = ".NET 8.0")]
|
||||
Binary file not shown.
@@ -0,0 +1,23 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Reflection;
|
||||
|
||||
[assembly: System.Reflection.AssemblyCompanyAttribute("classes")]
|
||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("classes")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("classes")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
||||
// Generated by the MSBuild WriteCodeFragment class.
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
219dc834389876ff433588408c20e3d7cdca3695b9851e11fcf1a46999ec9596
|
||||
@@ -0,0 +1,13 @@
|
||||
is_global = true
|
||||
build_property.TargetFramework = net8.0
|
||||
build_property.TargetPlatformMinVersion =
|
||||
build_property.UsingMicrosoftNETSdkWeb =
|
||||
build_property.ProjectTypeGuids =
|
||||
build_property.InvariantGlobalization =
|
||||
build_property.PlatformNeutralAssembly =
|
||||
build_property.EnforceExtendedAnalyzerRules =
|
||||
build_property._SupportedPlatformList = Linux,macOS,Windows
|
||||
build_property.RootNamespace = classes
|
||||
build_property.ProjectDir = C:\Users\dolce\OneDrive\Documents\CSCI\CSCI350\classes\
|
||||
build_property.EnableComHosting =
|
||||
build_property.EnableGeneratedComInterfaceComImportInterop =
|
||||
@@ -0,0 +1,8 @@
|
||||
// <auto-generated/>
|
||||
global using global::System;
|
||||
global using global::System.Collections.Generic;
|
||||
global using global::System.IO;
|
||||
global using global::System.Linq;
|
||||
global using global::System.Net.Http;
|
||||
global using global::System.Threading;
|
||||
global using global::System.Threading.Tasks;
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
0924bffa4b3c2e91bb3ea34aac81327c1d86228626627f8634a4a182dfd4572d
|
||||
@@ -0,0 +1,14 @@
|
||||
C:\Users\dolce\OneDrive\Documents\CSCI\CSCI350\classes\bin\Debug\net8.0\classes.exe
|
||||
C:\Users\dolce\OneDrive\Documents\CSCI\CSCI350\classes\bin\Debug\net8.0\classes.deps.json
|
||||
C:\Users\dolce\OneDrive\Documents\CSCI\CSCI350\classes\bin\Debug\net8.0\classes.runtimeconfig.json
|
||||
C:\Users\dolce\OneDrive\Documents\CSCI\CSCI350\classes\bin\Debug\net8.0\classes.dll
|
||||
C:\Users\dolce\OneDrive\Documents\CSCI\CSCI350\classes\bin\Debug\net8.0\classes.pdb
|
||||
C:\Users\dolce\OneDrive\Documents\CSCI\CSCI350\classes\obj\Debug\net8.0\classes.GeneratedMSBuildEditorConfig.editorconfig
|
||||
C:\Users\dolce\OneDrive\Documents\CSCI\CSCI350\classes\obj\Debug\net8.0\classes.AssemblyInfoInputs.cache
|
||||
C:\Users\dolce\OneDrive\Documents\CSCI\CSCI350\classes\obj\Debug\net8.0\classes.AssemblyInfo.cs
|
||||
C:\Users\dolce\OneDrive\Documents\CSCI\CSCI350\classes\obj\Debug\net8.0\classes.csproj.CoreCompileInputs.cache
|
||||
C:\Users\dolce\OneDrive\Documents\CSCI\CSCI350\classes\obj\Debug\net8.0\classes.dll
|
||||
C:\Users\dolce\OneDrive\Documents\CSCI\CSCI350\classes\obj\Debug\net8.0\refint\classes.dll
|
||||
C:\Users\dolce\OneDrive\Documents\CSCI\CSCI350\classes\obj\Debug\net8.0\classes.pdb
|
||||
C:\Users\dolce\OneDrive\Documents\CSCI\CSCI350\classes\obj\Debug\net8.0\classes.genruntimeconfig.cache
|
||||
C:\Users\dolce\OneDrive\Documents\CSCI\CSCI350\classes\obj\Debug\net8.0\ref\classes.dll
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
f3ad2441dda0f4f784463a10a895f78069401560f4916cf7300b1913dd51aa82
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,4 @@
|
||||
// <autogenerated />
|
||||
using System;
|
||||
using System.Reflection;
|
||||
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v8.0", FrameworkDisplayName = ".NET 8.0")]
|
||||
@@ -0,0 +1,23 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Reflection;
|
||||
|
||||
[assembly: System.Reflection.AssemblyCompanyAttribute("classes")]
|
||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")]
|
||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("classes")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("classes")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
||||
// Generated by the MSBuild WriteCodeFragment class.
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
482e88fe57bf06ff2e071bb54d6e78d8561f37ca3b55b0e63e4b88a64e42b8cc
|
||||
@@ -0,0 +1,13 @@
|
||||
is_global = true
|
||||
build_property.TargetFramework = net8.0
|
||||
build_property.TargetPlatformMinVersion =
|
||||
build_property.UsingMicrosoftNETSdkWeb =
|
||||
build_property.ProjectTypeGuids =
|
||||
build_property.InvariantGlobalization =
|
||||
build_property.PlatformNeutralAssembly =
|
||||
build_property.EnforceExtendedAnalyzerRules =
|
||||
build_property._SupportedPlatformList = Linux,macOS,Windows
|
||||
build_property.RootNamespace = classes
|
||||
build_property.ProjectDir = C:\Users\dolce\OneDrive\Documents\CSCI\CSCI350\classes\
|
||||
build_property.EnableComHosting =
|
||||
build_property.EnableGeneratedComInterfaceComImportInterop =
|
||||
@@ -0,0 +1,8 @@
|
||||
// <auto-generated/>
|
||||
global using global::System;
|
||||
global using global::System.Collections.Generic;
|
||||
global using global::System.IO;
|
||||
global using global::System.Linq;
|
||||
global using global::System.Net.Http;
|
||||
global using global::System.Threading;
|
||||
global using global::System.Threading.Tasks;
|
||||
Binary file not shown.
@@ -0,0 +1,67 @@
|
||||
{
|
||||
"format": 1,
|
||||
"restore": {
|
||||
"C:\\Users\\dolce\\OneDrive\\Documents\\CSCI\\CSCI350\\classes\\classes.csproj": {}
|
||||
},
|
||||
"projects": {
|
||||
"C:\\Users\\dolce\\OneDrive\\Documents\\CSCI\\CSCI350\\classes\\classes.csproj": {
|
||||
"version": "1.0.0",
|
||||
"restore": {
|
||||
"projectUniqueName": "C:\\Users\\dolce\\OneDrive\\Documents\\CSCI\\CSCI350\\classes\\classes.csproj",
|
||||
"projectName": "classes",
|
||||
"projectPath": "C:\\Users\\dolce\\OneDrive\\Documents\\CSCI\\CSCI350\\classes\\classes.csproj",
|
||||
"packagesPath": "C:\\Users\\dolce\\.nuget\\packages\\",
|
||||
"outputPath": "C:\\Users\\dolce\\OneDrive\\Documents\\CSCI\\CSCI350\\classes\\obj\\",
|
||||
"projectStyle": "PackageReference",
|
||||
"fallbackFolders": [
|
||||
"C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages"
|
||||
],
|
||||
"configFilePaths": [
|
||||
"C:\\Users\\dolce\\AppData\\Roaming\\NuGet\\NuGet.Config",
|
||||
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.FallbackLocation.config",
|
||||
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
|
||||
],
|
||||
"originalTargetFrameworks": [
|
||||
"net8.0"
|
||||
],
|
||||
"sources": {
|
||||
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
|
||||
"https://api.nuget.org/v3/index.json": {}
|
||||
},
|
||||
"frameworks": {
|
||||
"net8.0": {
|
||||
"targetAlias": "net8.0",
|
||||
"projectReferences": {}
|
||||
}
|
||||
},
|
||||
"warningProperties": {
|
||||
"warnAsError": [
|
||||
"NU1605"
|
||||
]
|
||||
}
|
||||
},
|
||||
"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.101/PortableRuntimeIdentifierGraph.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
|
||||
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
|
||||
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
|
||||
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
|
||||
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\dolce\.nuget\packages\;C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages</NuGetPackageFolders>
|
||||
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
|
||||
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.8.0</NuGetToolVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||
<SourceRoot Include="C:\Users\dolce\.nuget\packages\" />
|
||||
<SourceRoot Include="C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages\" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,2 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" />
|
||||
@@ -0,0 +1,73 @@
|
||||
{
|
||||
"version": 3,
|
||||
"targets": {
|
||||
"net8.0": {}
|
||||
},
|
||||
"libraries": {},
|
||||
"projectFileDependencyGroups": {
|
||||
"net8.0": []
|
||||
},
|
||||
"packageFolders": {
|
||||
"C:\\Users\\dolce\\.nuget\\packages\\": {},
|
||||
"C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages": {}
|
||||
},
|
||||
"project": {
|
||||
"version": "1.0.0",
|
||||
"restore": {
|
||||
"projectUniqueName": "C:\\Users\\dolce\\OneDrive\\Documents\\CSCI\\CSCI350\\classes\\classes.csproj",
|
||||
"projectName": "classes",
|
||||
"projectPath": "C:\\Users\\dolce\\OneDrive\\Documents\\CSCI\\CSCI350\\classes\\classes.csproj",
|
||||
"packagesPath": "C:\\Users\\dolce\\.nuget\\packages\\",
|
||||
"outputPath": "C:\\Users\\dolce\\OneDrive\\Documents\\CSCI\\CSCI350\\classes\\obj\\",
|
||||
"projectStyle": "PackageReference",
|
||||
"fallbackFolders": [
|
||||
"C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages"
|
||||
],
|
||||
"configFilePaths": [
|
||||
"C:\\Users\\dolce\\AppData\\Roaming\\NuGet\\NuGet.Config",
|
||||
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.FallbackLocation.config",
|
||||
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
|
||||
],
|
||||
"originalTargetFrameworks": [
|
||||
"net8.0"
|
||||
],
|
||||
"sources": {
|
||||
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
|
||||
"https://api.nuget.org/v3/index.json": {}
|
||||
},
|
||||
"frameworks": {
|
||||
"net8.0": {
|
||||
"targetAlias": "net8.0",
|
||||
"projectReferences": {}
|
||||
}
|
||||
},
|
||||
"warningProperties": {
|
||||
"warnAsError": [
|
||||
"NU1605"
|
||||
]
|
||||
}
|
||||
},
|
||||
"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.101/PortableRuntimeIdentifierGraph.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"version": 2,
|
||||
"dgSpecHash": "VJ/NmR1hCQ/gX5QCpU+Q5k/lJNoQRTBBE7RZ/7epvJcThMr8I+GdRb6ZchNqpWm5C6v5Pzc/SuIShbANG3v6jg==",
|
||||
"success": true,
|
||||
"projectFilePath": "C:\\Users\\dolce\\OneDrive\\Documents\\CSCI\\CSCI350\\classes\\classes.csproj",
|
||||
"expectedPackageFiles": [],
|
||||
"logs": []
|
||||
}
|
||||
Reference in new issue
Block a user