CS2B start

This commit is contained in:
Rens Pastoor
2025-06-08 17:11:09 +02:00
parent 0a53cd8bd4
commit de4fd98cc7
43 changed files with 450 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
# Default ignored files
/shelf/
/workspace.xml
# Rider ignored files
/projectSettingsUpdater.xml
/modules.xml
/.idea.CS2B shipping company.iml
/contentModel.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="UserContentModel">
<attachedFolders />
<explicitIncludes />
<explicitExcludes />
</component>
</project>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/../.." vcs="Git" />
</component>
</project>

View File

@@ -0,0 +1,16 @@

Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CS2B shipping company", "CS2B shipping company\CS2B shipping company.csproj", "{2E5A9359-DD17-4982-8329-7B046DA2DDA2}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{2E5A9359-DD17-4982-8329-7B046DA2DDA2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2E5A9359-DD17-4982-8329-7B046DA2DDA2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2E5A9359-DD17-4982-8329-7B046DA2DDA2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2E5A9359-DD17-4982-8329-7B046DA2DDA2}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net9.0</TargetFramework>
<RootNamespace>CS2B_shipping_company</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,6 @@
namespace CS2B_shipping_company;
public class Company
{
}

View File

@@ -0,0 +1,19 @@
namespace CS2B_shipping_company;
public abstract class BaseContainer
{
private static int idCount = 1000;
public int Id { get; }
public string Description { get; set; }
public string CountryOfOrigin { get; set; }
protected BaseContainer(string description, string countryOfOrigin)
{
Id = idCount++;
Description = description;
CountryOfOrigin = countryOfOrigin;
}
public abstract float Fee();
}

View File

@@ -0,0 +1,33 @@
namespace CS2B_shipping_company;
public class FullContainer : BaseContainer
{
private const float FeePerKg = 0.91f;
private const float FridgePercentage = 0.08f;
private const int MaxWeight = 20000;
private int weight;
public int Weight
{
get => weight;
set
{
if (value > MaxWeight)
throw new WeightExceededException($"Weight cannot exceed {MaxWeight}kg");
weight = value;
}
}
public bool IsRefrigerated { get; set; }
public FullContainer(string description, string countryOfOrigin)
: base(description, countryOfOrigin) { }
public override float Fee()
{
float fee = Weight * FeePerKg;
if (IsRefrigerated)
fee += fee * FridgePercentage;
return fee;
}
}

View File

@@ -0,0 +1,24 @@
namespace CS2B_shipping_company;
public class HalfContainer : BaseContainer
{
private const float FeePerM3 = 19.37f;
private const int MaxVolume = 40;
private int volume;
public int Volume
{
get => volume;
set
{
if (value > MaxVolume)
throw new VolumeExceededException($"Volume cannot exceed {MaxVolume}m³");
volume = value;
}
}
public HalfContainer(string description, string countryOfOrigin)
: base(description, countryOfOrigin) { }
public override float Fee() => Volume * FeePerM3;
}

View File

@@ -0,0 +1,11 @@
namespace CS2B_shipping_company;
public class QuarterContainer : BaseContainer
{
private const float FixedFee = 1692.72f;
public QuarterContainer(string description, string countryOfOrigin)
: base(description, countryOfOrigin) { }
public override float Fee() => FixedFee;
}

View File

@@ -0,0 +1,6 @@
namespace CS2B_shipping_company;
public class InvalidInputException : ShippingException
{
public InvalidInputException(string message) : base(message) { }
}

View File

@@ -0,0 +1,6 @@
namespace CS2B_shipping_company;
public class ShippingException : Exception
{
public ShippingException(string message) : base(message) { }
}

View File

@@ -0,0 +1,6 @@
namespace CS2B_shipping_company;
public class VolumeExceededException : ShippingException
{
public VolumeExceededException(string message) : base(message) { }
}

View File

@@ -0,0 +1,6 @@
namespace CS2B_shipping_company;
public class WeightExceededException : ShippingException
{
public WeightExceededException(string message) : base(message) { }
}

View File

@@ -0,0 +1,9 @@
namespace CS2B_shipping_company;
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello, World!");
}
}

View File

@@ -0,0 +1,6 @@
namespace CS2B_shipping_company;
public class Server
{
}

View File

@@ -0,0 +1,23 @@
{
"runtimeTarget": {
"name": ".NETCoreApp,Version=v9.0",
"signature": ""
},
"compilationOptions": {},
"targets": {
".NETCoreApp,Version=v9.0": {
"CS2B shipping company/1.0.0": {
"runtime": {
"CS2B shipping company.dll": {}
}
}
}
},
"libraries": {
"CS2B shipping company/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
}
}
}

View File

@@ -0,0 +1,12 @@
{
"runtimeOptions": {
"tfm": "net9.0",
"framework": {
"name": "Microsoft.NETCore.App",
"version": "9.0.0"
},
"configProperties": {
"System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false
}
}
}

View File

@@ -0,0 +1,67 @@
{
"format": 1,
"restore": {
"/home/rens/files/T2/CS/CS2B shipping company/CS2B shipping company/CS2B shipping company.csproj": {}
},
"projects": {
"/home/rens/files/T2/CS/CS2B shipping company/CS2B shipping company/CS2B shipping company.csproj": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "/home/rens/files/T2/CS/CS2B shipping company/CS2B shipping company/CS2B shipping company.csproj",
"projectName": "CS2B shipping company",
"projectPath": "/home/rens/files/T2/CS/CS2B shipping company/CS2B shipping company/CS2B shipping company.csproj",
"packagesPath": "/home/rens/.nuget/packages/",
"outputPath": "/home/rens/T2/CS/CS2B shipping company/CS2B shipping company/obj/",
"projectStyle": "PackageReference",
"configFilePaths": [
"/home/rens/.nuget/NuGet/NuGet.Config"
],
"originalTargetFrameworks": [
"net9.0"
],
"sources": {
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
"net9.0": {
"targetAlias": "net9.0",
"projectReferences": {}
}
},
"warningProperties": {
"warnAsError": [
"NU1605"
]
},
"restoreAuditProperties": {
"enableAudit": "true",
"auditLevel": "low",
"auditMode": "direct"
},
"SdkAnalysisLevel": "9.0.300"
},
"frameworks": {
"net9.0": {
"targetAlias": "net9.0",
"imports": [
"net461",
"net462",
"net47",
"net471",
"net472",
"net48",
"net481"
],
"assetTargetFallback": true,
"warn": true,
"frameworkReferences": {
"Microsoft.NETCore.App": {
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "/home/rens/.dotnet/sdk/9.0.300/PortableRuntimeIdentifierGraph.json"
}
}
}
}
}

View File

@@ -0,0 +1,15 @@
<?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)' == '' ">/home/rens/.nuget/packages/</NuGetPackageRoot>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">/home/rens/.nuget/packages/</NuGetPackageFolders>
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.12.2</NuGetToolVersion>
</PropertyGroup>
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<SourceRoot Include="/home/rens/.nuget/packages/" />
</ItemGroup>
</Project>

View File

@@ -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" />

View File

@@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v9.0", FrameworkDisplayName = ".NET 9.0")]

View File

@@ -0,0 +1,22 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// 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("CS2B shipping company")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+0a53cd8bd45341b69a3feec05a574e84f196f04b")]
[assembly: System.Reflection.AssemblyProductAttribute("CS2B shipping company")]
[assembly: System.Reflection.AssemblyTitleAttribute("CS2B shipping company")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
// Generated by the MSBuild WriteCodeFragment class.

View File

@@ -0,0 +1 @@
a8e586fa0f061cb0aaa5439753f525a2a3c0bf7950ed6c35dd6c9efc1c049d73

View File

@@ -0,0 +1,15 @@
is_global = true
build_property.TargetFramework = net9.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 = CS2B_shipping_company
build_property.ProjectDir = /home/rens/T2/CS/CS2B shipping company/CS2B shipping company/
build_property.EnableComHosting =
build_property.EnableGeneratedComInterfaceComImportInterop =
build_property.EffectiveAnalysisLevelStyle = 9.0
build_property.EnableCodeStyleSeverity =

View File

@@ -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;

View File

@@ -0,0 +1 @@
e5784bd8f6c60153fa7304c9656481c7b428255fd00993a6dce0cafe9bcc8366

View File

@@ -0,0 +1,10 @@
/home/rens/files/T2/CS/CS2B shipping company/CS2B shipping company/bin/Debug/net9.0/CS2B shipping company
/home/rens/files/T2/CS/CS2B shipping company/CS2B shipping company/bin/Debug/net9.0/CS2B shipping company.dll
/home/rens/files/T2/CS/CS2B shipping company/CS2B shipping company/bin/Debug/net9.0/CS2B shipping company.pdb
/home/rens/files/T2/CS/CS2B shipping company/CS2B shipping company/obj/Debug/net9.0/CS2B shipping company.GeneratedMSBuildEditorConfig.editorconfig
/home/rens/files/T2/CS/CS2B shipping company/CS2B shipping company/obj/Debug/net9.0/CS2B shipping company.AssemblyInfoInputs.cache
/home/rens/files/T2/CS/CS2B shipping company/CS2B shipping company/obj/Debug/net9.0/CS2B shipping company.AssemblyInfo.cs
/home/rens/files/T2/CS/CS2B shipping company/CS2B shipping company/obj/Debug/net9.0/CS2B shipping company.csproj.CoreCompileInputs.cache
/home/rens/files/T2/CS/CS2B shipping company/CS2B shipping company/obj/Debug/net9.0/CS2B shipping company.dll
/home/rens/files/T2/CS/CS2B shipping company/CS2B shipping company/obj/Debug/net9.0/refint/CS2B shipping company.dll
/home/rens/files/T2/CS/CS2B shipping company/CS2B shipping company/obj/Debug/net9.0/CS2B shipping company.pdb

View File

@@ -0,0 +1 @@
359c231ad0ab162505dccc65a44df9ca96011831389af188175a0715d3cde94f

View File

@@ -0,0 +1,72 @@
{
"version": 3,
"targets": {
"net9.0": {}
},
"libraries": {},
"projectFileDependencyGroups": {
"net9.0": []
},
"packageFolders": {
"/home/rens/.nuget/packages/": {}
},
"project": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "/home/rens/files/T2/CS/CS2B shipping company/CS2B shipping company/CS2B shipping company.csproj",
"projectName": "CS2B shipping company",
"projectPath": "/home/rens/files/T2/CS/CS2B shipping company/CS2B shipping company/CS2B shipping company.csproj",
"packagesPath": "/home/rens/.nuget/packages/",
"outputPath": "/home/rens/T2/CS/CS2B shipping company/CS2B shipping company/obj/",
"projectStyle": "PackageReference",
"configFilePaths": [
"/home/rens/.nuget/NuGet/NuGet.Config"
],
"originalTargetFrameworks": [
"net9.0"
],
"sources": {
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
"net9.0": {
"targetAlias": "net9.0",
"projectReferences": {}
}
},
"warningProperties": {
"warnAsError": [
"NU1605"
]
},
"restoreAuditProperties": {
"enableAudit": "true",
"auditLevel": "low",
"auditMode": "direct"
},
"SdkAnalysisLevel": "9.0.300"
},
"frameworks": {
"net9.0": {
"targetAlias": "net9.0",
"imports": [
"net461",
"net462",
"net47",
"net471",
"net472",
"net48",
"net481"
],
"assetTargetFallback": true,
"warn": true,
"frameworkReferences": {
"Microsoft.NETCore.App": {
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "/home/rens/.dotnet/sdk/9.0.300/PortableRuntimeIdentifierGraph.json"
}
}
}
}

View File

@@ -0,0 +1,8 @@
{
"version": 2,
"dgSpecHash": "7g+wE+CVdHE=",
"success": true,
"projectFilePath": "/home/rens/T2/CS/CS2B shipping company/CS2B shipping company/CS2B shipping company.csproj",
"expectedPackageFiles": [],
"logs": []
}

View File

@@ -0,0 +1 @@
"restore":{"projectUniqueName":"/home/rens/files/T2/CS/CS2B shipping company/CS2B shipping company/CS2B shipping company.csproj","projectName":"CS2B shipping company","projectPath":"/home/rens/files/T2/CS/CS2B shipping company/CS2B shipping company/CS2B shipping company.csproj","outputPath":"/home/rens/files/T2/CS/CS2B shipping company/CS2B shipping company/obj/","projectStyle":"PackageReference","originalTargetFrameworks":["net9.0"],"sources":{"https://api.nuget.org/v3/index.json":{}},"frameworks":{"net9.0":{"targetAlias":"net9.0","projectReferences":{}}},"warningProperties":{"warnAsError":["NU1605"]},"restoreAuditProperties":{"enableAudit":"true","auditLevel":"low","auditMode":"direct"},"SdkAnalysisLevel":"9.0.300"}"frameworks":{"net9.0":{"targetAlias":"net9.0","imports":["net461","net462","net47","net471","net472","net48","net481"],"assetTargetFallback":true,"warn":true,"frameworkReferences":{"Microsoft.NETCore.App":{"privateAssets":"all"}},"runtimeIdentifierGraphPath":"/home/rens/.dotnet/sdk/9.0.300/PortableRuntimeIdentifierGraph.json"}}

View File

@@ -0,0 +1 @@
17493942230565017

View File

@@ -0,0 +1 @@
17493942230565017