Add project files.
This commit is contained in:
parent
06819941a9
commit
7f70743cf8
|
|
@ -0,0 +1,31 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.9.34622.214
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Coursework", "Coursework\Coursework.vcxproj", "{823D08D7-C6EC-43F1-B960-910C513CFE62}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{823D08D7-C6EC-43F1-B960-910C513CFE62}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{823D08D7-C6EC-43F1-B960-910C513CFE62}.Debug|x64.Build.0 = Debug|x64
|
||||
{823D08D7-C6EC-43F1-B960-910C513CFE62}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{823D08D7-C6EC-43F1-B960-910C513CFE62}.Debug|x86.Build.0 = Debug|Win32
|
||||
{823D08D7-C6EC-43F1-B960-910C513CFE62}.Release|x64.ActiveCfg = Release|x64
|
||||
{823D08D7-C6EC-43F1-B960-910C513CFE62}.Release|x64.Build.0 = Release|x64
|
||||
{823D08D7-C6EC-43F1-B960-910C513CFE62}.Release|x86.ActiveCfg = Release|Win32
|
||||
{823D08D7-C6EC-43F1-B960-910C513CFE62}.Release|x86.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {B12202D9-2A7E-49E3-97B3-BBF511E8B065}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
|
@ -0,0 +1 @@
|
|||
#include "Account.h"
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
#pragma once
|
||||
#include "AccountRequisites.h"
|
||||
#include "Product.h"
|
||||
|
||||
class Account : public Product
|
||||
{
|
||||
public:
|
||||
unsigned long long balance = 0;
|
||||
AccountRequisites accountRequisites;
|
||||
|
||||
Account() : Product("Áàíêîâñêèé ñ÷¸ò") {};
|
||||
Account(
|
||||
bool isAvailable,
|
||||
unsigned long long balance,
|
||||
AccountRequisites accountRequisites
|
||||
) : Product(
|
||||
"Áàíêîâñêèé ñ÷¸ò",
|
||||
isAvailable
|
||||
) {
|
||||
this->balance = balance;
|
||||
this->accountRequisites = accountRequisites;
|
||||
};
|
||||
|
||||
void withdraw(unsigned long long balance) {};
|
||||
void deposit(unsigned long long amount) {};
|
||||
};
|
||||
|
||||
|
|
@ -0,0 +1 @@
|
|||
#include "AccountRequisites.h"
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
#pragma once
|
||||
#include <string>
|
||||
#include "BankRequisites.h"
|
||||
|
||||
class AccountRequisites
|
||||
{
|
||||
public:
|
||||
std::string owner = "";
|
||||
unsigned long long accountNumber = 0;
|
||||
BankRequisites bankRequisites;
|
||||
|
||||
AccountRequisites() = default;
|
||||
AccountRequisites(
|
||||
std::string owner,
|
||||
unsigned long long accountNumber,
|
||||
BankRequisites bankRequisites
|
||||
) {
|
||||
this->owner = owner;
|
||||
this->accountNumber = accountNumber;
|
||||
this->bankRequisites = bankRequisites;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -0,0 +1 @@
|
|||
#include "Address.h"
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
#pragma once
|
||||
#include <string>
|
||||
|
||||
class Address
|
||||
{
|
||||
public:
|
||||
std::string country = "";
|
||||
std::string state = "";
|
||||
std::string city = "";
|
||||
unsigned int postalCode = 0;
|
||||
std::string street = "";
|
||||
unsigned int building = 0;
|
||||
Address() = default;
|
||||
Address(
|
||||
std::string country,
|
||||
std::string state,
|
||||
std::string city,
|
||||
unsigned int postalCode,
|
||||
std::string street,
|
||||
unsigned int building
|
||||
) {
|
||||
this->country = country;
|
||||
this->state = state;
|
||||
this->city = city;
|
||||
this->postalCode = postalCode;
|
||||
this->street = street;
|
||||
this->building = building;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -0,0 +1 @@
|
|||
#include "Bank.h"
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
#pragma once
|
||||
#include <time.h>
|
||||
#include "WorkingHours.h"
|
||||
#include "BankRequisites.h"
|
||||
|
||||
class Bank
|
||||
{
|
||||
public:
|
||||
|
||||
WorkingHours workingHours;
|
||||
BankRequisites bankRequisites;
|
||||
|
||||
Bank() = default;
|
||||
|
||||
Bank(WorkingHours workingHours, BankRequisites bankRequisites) {
|
||||
this->workingHours = workingHours;
|
||||
this->bankRequisites = bankRequisites;
|
||||
};
|
||||
|
||||
bool isWorkingNow() {
|
||||
unsigned int currentHours = ((time(0) / 3600) % 24) + 4 ;
|
||||
return (
|
||||
currentHours >= workingHours.getFrom() && \
|
||||
currentHours < workingHours.getTo()) ? true : false;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
|
|
@ -0,0 +1 @@
|
|||
#include "BankBranch.h"
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
#pragma once
|
||||
#include "Bank.h"
|
||||
#include "Product.h"
|
||||
#include "Employee.h"
|
||||
#include <vector>
|
||||
|
||||
class BankBranch : public Bank
|
||||
{
|
||||
public:
|
||||
|
||||
std::vector<Product> productList = {};
|
||||
std::vector<Employee> employeeList = {};
|
||||
|
||||
BankBranch() = default;
|
||||
BankBranch(
|
||||
WorkingHours workingHours,
|
||||
BankRequisites bankRequisites
|
||||
) : Bank(
|
||||
workingHours,
|
||||
bankRequisites
|
||||
) {
|
||||
|
||||
}
|
||||
|
||||
void report() {
|
||||
//report to headquarter
|
||||
};
|
||||
};
|
||||
|
||||
|
|
@ -0,0 +1 @@
|
|||
#include "BankRequisites.h"
|
||||
|
|
@ -0,0 +1,77 @@
|
|||
#pragma once
|
||||
#include <string>
|
||||
#include "Address.h"
|
||||
|
||||
class BankRequisites
|
||||
{
|
||||
public:
|
||||
std::string bankName = "";
|
||||
unsigned long long bankBIK = 0;
|
||||
unsigned long long bankCorrAccount = 0;
|
||||
unsigned long long bankINN = 0;
|
||||
unsigned long long bankKPP = 0;
|
||||
unsigned long long bankOKPO = 0;
|
||||
unsigned long long bankOGRN = 0;
|
||||
std::string bankSWIFTcode = "";
|
||||
Address addressMain;
|
||||
Address addressSub;
|
||||
|
||||
BankRequisites() = default;
|
||||
BankRequisites(
|
||||
std::string bankName,
|
||||
unsigned long long bankBIK,
|
||||
unsigned long long bankCorrAccount,
|
||||
unsigned long long bankINN,
|
||||
unsigned long long bankKPP,
|
||||
unsigned long long bankOKPO,
|
||||
unsigned long long bankOGRN,
|
||||
std::string bankSWIFTcode,
|
||||
Address addressMain,
|
||||
Address addressSub
|
||||
) {
|
||||
this->bankName = bankName;
|
||||
this->bankBIK = bankBIK;
|
||||
this->bankCorrAccount = bankCorrAccount;
|
||||
this->bankINN = bankINN;
|
||||
this->bankKPP = bankKPP;
|
||||
this->bankOKPO = bankOKPO;
|
||||
this->bankOGRN = bankOGRN;
|
||||
this->bankSWIFTcode = bankSWIFTcode;
|
||||
this->addressMain = addressMain;
|
||||
this->addressSub = addressSub;
|
||||
};
|
||||
//Constructor for bank without branch
|
||||
BankRequisites(
|
||||
std::string bankName,
|
||||
unsigned long long bankBIK,
|
||||
unsigned long long bankCorrAccount,
|
||||
unsigned long long bankINN,
|
||||
unsigned long long bankKPP,
|
||||
unsigned long long bankOKPO,
|
||||
unsigned long long bankOGRN,
|
||||
std::string bankSWIFTcode,
|
||||
Address addressMain
|
||||
) {
|
||||
this->bankName = bankName;
|
||||
this->bankBIK = bankBIK;
|
||||
this->bankCorrAccount = bankCorrAccount;
|
||||
this->bankINN = bankINN;
|
||||
this->bankKPP = bankKPP;
|
||||
this->bankOKPO = bankOKPO;
|
||||
this->bankOGRN = bankOGRN;
|
||||
this->bankSWIFTcode = bankSWIFTcode;
|
||||
this->addressMain = addressMain;
|
||||
this->addressSub = Address();
|
||||
};
|
||||
//Constructor for transaction
|
||||
BankRequisites(
|
||||
std::string bankName,
|
||||
unsigned long long bankBIK,
|
||||
unsigned long long bankCorrAccount
|
||||
) {
|
||||
this->bankName = bankName;
|
||||
this->bankBIK = bankBIK;
|
||||
this->bankCorrAccount = bankCorrAccount;
|
||||
};
|
||||
};
|
||||
|
||||
|
|
@ -0,0 +1 @@
|
|||
#include "CarLoan.h"
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
#pragma once
|
||||
#include "Loan.h"
|
||||
#include "Insurance.h"
|
||||
|
||||
class CarLoan :
|
||||
public Loan
|
||||
{
|
||||
public:
|
||||
std::string make = "";
|
||||
std::string model = "";
|
||||
unsigned int year = 0;
|
||||
Insurance insurance;
|
||||
CarLoan() : Loan("Àâòîêðåäèò") {};
|
||||
CarLoan(
|
||||
bool isAvailable,
|
||||
Account account,
|
||||
unsigned long long amount,
|
||||
double percent,
|
||||
unsigned int durationInMonths,
|
||||
std::string make,
|
||||
std::string model,
|
||||
unsigned int year
|
||||
) : Loan(
|
||||
"Àâòîêðåäèò",
|
||||
isAvailable,
|
||||
account,
|
||||
amount,
|
||||
percent,
|
||||
durationInMonths
|
||||
) {
|
||||
this->make = make;
|
||||
this->model = model;
|
||||
this->year = year;
|
||||
};
|
||||
void applyInsurance(
|
||||
Insurance insurance
|
||||
) {
|
||||
this->insurance = insurance;
|
||||
};
|
||||
};
|
||||
|
||||
|
|
@ -0,0 +1 @@
|
|||
#include "Card.h"
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
#pragma once
|
||||
#include "Product.h"
|
||||
#include "Account.h"
|
||||
|
||||
class Card : public Product
|
||||
{
|
||||
public:
|
||||
Account account;
|
||||
unsigned long long number = 0;
|
||||
std::string cardHolderName = "";
|
||||
unsigned int expirationDate = 0;
|
||||
unsigned int CVV = 0;
|
||||
|
||||
Card() : Product("Áàíêîâñêàÿ êàðòà") {};
|
||||
Card(
|
||||
bool isAvailable,
|
||||
Account account,
|
||||
unsigned long long number,
|
||||
std::string cardHolderName,
|
||||
unsigned int expirationDate,
|
||||
unsigned int CVV
|
||||
) : Product(
|
||||
"Áàíêîâñêàÿ Êàðòà",
|
||||
isAvailable
|
||||
) {
|
||||
this->account = account;
|
||||
this->number = number;
|
||||
this->cardHolderName = cardHolderName;
|
||||
this->expirationDate = expirationDate;
|
||||
this->CVV = CVV;
|
||||
};
|
||||
void ban() {};
|
||||
};
|
||||
|
||||
|
|
@ -0,0 +1 @@
|
|||
#include "Cash.h"
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
#pragma once
|
||||
#include "Transaction.h"
|
||||
class Cash :
|
||||
public Transaction
|
||||
{
|
||||
public:
|
||||
Cash() : Transaction("Îïåðàöèè ñ íàëè÷íûìè") {};
|
||||
|
||||
Cash(
|
||||
bool isAvailable,
|
||||
AccountRequisites payerRequisites,
|
||||
AccountRequisites recipientRequisites,
|
||||
unsigned long long amount,
|
||||
unsigned int date
|
||||
) : Transaction(
|
||||
"Îïåðàöèè ñ íàëè÷íûìè",
|
||||
isAvailable,
|
||||
payerRequisites,
|
||||
recipientRequisites,
|
||||
amount,
|
||||
date
|
||||
) {};
|
||||
|
||||
void cashIn(unsigned long long amount) {};
|
||||
void cashOut(unsigned long long amount) {};
|
||||
};
|
||||
|
||||
|
|
@ -0,0 +1 @@
|
|||
#include "ConsumerLoan.h"
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
#pragma once
|
||||
#include "Loan.h"
|
||||
|
||||
class ConsumerLoan :
|
||||
public Loan
|
||||
{
|
||||
public:
|
||||
std::string purpose = "";
|
||||
ConsumerLoan() : Loan("Ïîòðåáèòåëüñêèé êðåäèò") {};
|
||||
ConsumerLoan(
|
||||
bool isAvailable,
|
||||
Account account,
|
||||
unsigned long long amount,
|
||||
double percent,
|
||||
unsigned int durationInMonths,
|
||||
std::string purpose
|
||||
) : Loan(
|
||||
"Ïîòðåáèòåëüñêèé êðåäèò",
|
||||
isAvailable,
|
||||
account,
|
||||
amount,
|
||||
percent,
|
||||
durationInMonths
|
||||
) {
|
||||
this->purpose = purpose;
|
||||
};
|
||||
void increase(unsigned long long amount) {};
|
||||
};
|
||||
|
||||
|
|
@ -0,0 +1,187 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>17.0</VCProjectVersion>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<ProjectGuid>{823d08d7-c6ec-43f1-b960-910c513cfe62}</ProjectGuid>
|
||||
<RootNamespace>Coursework</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Account.cpp" />
|
||||
<ClCompile Include="AccountRequisites.cpp" />
|
||||
<ClCompile Include="Address.cpp" />
|
||||
<ClCompile Include="Bank.cpp" />
|
||||
<ClCompile Include="BankBranch.cpp" />
|
||||
<ClCompile Include="BankRequisites.cpp" />
|
||||
<ClCompile Include="Card.cpp" />
|
||||
<ClCompile Include="CarLoan.cpp" />
|
||||
<ClCompile Include="Cash.cpp" />
|
||||
<ClCompile Include="ConsumerLoan.cpp" />
|
||||
<ClCompile Include="CurrencyExchange.cpp" />
|
||||
<ClCompile Include="Customer.cpp" />
|
||||
<ClCompile Include="Deposit.cpp" />
|
||||
<ClCompile Include="Employee.cpp" />
|
||||
<ClCompile Include="Enums.cpp" />
|
||||
<ClCompile Include="Insurance.cpp" />
|
||||
<ClCompile Include="Investment.cpp" />
|
||||
<ClCompile Include="Loan.cpp" />
|
||||
<ClCompile Include="Main.cpp" />
|
||||
<ClCompile Include="Mortgage.cpp" />
|
||||
<ClCompile Include="Payment.cpp" />
|
||||
<ClCompile Include="Person.cpp" />
|
||||
<ClCompile Include="Product.cpp" />
|
||||
<ClCompile Include="Simulation.cpp" />
|
||||
<ClCompile Include="Transaction.cpp" />
|
||||
<ClCompile Include="WorkingHours.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Account.h" />
|
||||
<ClInclude Include="AccountRequisites.h" />
|
||||
<ClInclude Include="Address.h" />
|
||||
<ClInclude Include="Bank.h" />
|
||||
<ClInclude Include="BankBranch.h" />
|
||||
<ClInclude Include="BankRequisites.h" />
|
||||
<ClInclude Include="Card.h" />
|
||||
<ClInclude Include="CarLoan.h" />
|
||||
<ClInclude Include="Cash.h" />
|
||||
<ClInclude Include="ConsumerLoan.h" />
|
||||
<ClInclude Include="CurrencyExchange.h" />
|
||||
<ClInclude Include="Customer.h" />
|
||||
<ClInclude Include="Deposit.h" />
|
||||
<ClInclude Include="Employee.h" />
|
||||
<ClInclude Include="Enums.h" />
|
||||
<ClInclude Include="Insurance.h" />
|
||||
<ClInclude Include="Investment.h" />
|
||||
<ClInclude Include="Loan.h" />
|
||||
<ClInclude Include="Mortgage.h" />
|
||||
<ClInclude Include="Payment.h" />
|
||||
<ClInclude Include="Person.h" />
|
||||
<ClInclude Include="Product.h" />
|
||||
<ClInclude Include="Simulation.h" />
|
||||
<ClInclude Include="Transaction.h" />
|
||||
<ClInclude Include="WorkingHours.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
|
|
@ -0,0 +1,174 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Main.cpp">
|
||||
<Filter>Resource Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Bank.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="WorkingHours.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="BankRequisites.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Address.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="BankBranch.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Product.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Person.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Customer.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Enums.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Employee.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="AccountRequisites.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Account.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Investment.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Loan.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="CarLoan.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Insurance.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Mortgage.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ConsumerLoan.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Deposit.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Card.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Transaction.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Payment.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="CurrencyExchange.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Cash.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Simulation.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Bank.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="WorkingHours.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="BankRequisites.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Address.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="BankBranch.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Product.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Person.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Customer.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Enums.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Employee.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="AccountRequisites.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Account.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Investment.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Loan.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="CarLoan.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Insurance.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Mortgage.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ConsumerLoan.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Deposit.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Card.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Transaction.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Payment.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="CurrencyExchange.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Cash.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Simulation.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
|
@ -0,0 +1 @@
|
|||
#include "CurrencyExchange.h"
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
#pragma once
|
||||
#include "Transaction.h"
|
||||
#include "Enums.h"
|
||||
#include <string>
|
||||
|
||||
class CurrencyExchange :
|
||||
public Transaction
|
||||
{
|
||||
public:
|
||||
Currency currencyFrom;
|
||||
Currency currencyTo;
|
||||
|
||||
CurrencyExchange() :Transaction("Îáìåí âàëþòû") {};
|
||||
CurrencyExchange(
|
||||
bool isAvailable,
|
||||
AccountRequisites payerRequisites,
|
||||
AccountRequisites recipientRequisites,
|
||||
unsigned long long amount,
|
||||
unsigned int date,
|
||||
Currency currencyFrom,
|
||||
Currency currencyTo
|
||||
) : Transaction(
|
||||
"Îáìåí âàëþòû",
|
||||
isAvailable,
|
||||
payerRequisites,
|
||||
recipientRequisites,
|
||||
amount,
|
||||
date
|
||||
) {
|
||||
this->currencyFrom = currencyFrom;
|
||||
this->currencyTo = currencyTo;
|
||||
};
|
||||
std::string executeTest() {
|
||||
return (this->currencyTo == USD) ? \
|
||||
"Îïåðàöèÿ îòêëîíåíà, íåò âàëþòû USD\n": \
|
||||
"Îïåðàöèÿ èñïîëíåíà\n";
|
||||
};
|
||||
};
|
||||
|
||||
|
|
@ -0,0 +1 @@
|
|||
#include "Customer.h"
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
#pragma once
|
||||
#include "Person.h"
|
||||
#include "Enums.h"
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
class Customer : public Person
|
||||
{
|
||||
public:
|
||||
std::vector<Need> needList;
|
||||
|
||||
Customer() = default;
|
||||
Customer(std::string name, std::vector<Need> needList) : Person(name) {
|
||||
this->needList = needList;
|
||||
};
|
||||
|
||||
std::string askForHelp(Need need) {
|
||||
return needConverter(need);
|
||||
};
|
||||
std::string askForHelp(std::string verboseNeed) {
|
||||
return verboseNeed;
|
||||
};
|
||||
};
|
||||
|
||||
|
|
@ -0,0 +1 @@
|
|||
#include "Deposit.h"
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
#pragma once
|
||||
#include "Product.h"
|
||||
#include "Account.h"
|
||||
|
||||
class Deposit : public Product
|
||||
{
|
||||
public:
|
||||
Account account;
|
||||
unsigned long long amount = 0;
|
||||
|
||||
Deposit() : Product("Áàíêîâñêèé âêëàä") {};
|
||||
Deposit(
|
||||
bool isAvailable,
|
||||
Account account,
|
||||
unsigned long long amount
|
||||
) : Product(
|
||||
"Áàíêîâñêèé âêëàä",
|
||||
isAvailable
|
||||
) {
|
||||
this->account = account;
|
||||
this->amount = amount;
|
||||
};
|
||||
};
|
||||
|
||||
|
|
@ -0,0 +1 @@
|
|||
#include "Employee.h"
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
#pragma once
|
||||
#include "Enums.h"
|
||||
#include "Person.h"
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
#include "Product.h"
|
||||
#include "Account.h"
|
||||
#include "Customer.h"
|
||||
|
||||
class Employee : public Person
|
||||
{
|
||||
public:
|
||||
JobTitle jobTitle;
|
||||
|
||||
Employee() = default;
|
||||
Employee(std::string name, JobTitle jobTitle) : Person(name) {
|
||||
this->jobTitle = jobTitle;
|
||||
};
|
||||
|
||||
std::string auth(Person person) {
|
||||
return (this->name + " ïðîâîäèò èäåíòèôèêàöèþ " +\
|
||||
person.name + "\n");
|
||||
};
|
||||
unsigned long long getBalanceRemainder(Account account) {
|
||||
return account.balance;
|
||||
};
|
||||
std::string offerHelp(Person person, std::vector<Product> productList) {
|
||||
std::string productListToString = "";
|
||||
for (Product product: productList) {
|
||||
productListToString += product.productName + "\n";
|
||||
};
|
||||
return (this->name + " ïðåäëàãàåò " + person.name + \
|
||||
", ñëåäóþùèå ïðîäóêòû:\n" + productListToString);
|
||||
};
|
||||
std::string denyService(Person person) {
|
||||
return (person.name + " îòêàçàíî â îáñëóæèâàíèè\n");
|
||||
};
|
||||
std::string executeTest(Customer customer) {
|
||||
int cnt = std::count(customer.needList.begin(), customer.needList.end(), UnknownNeed);
|
||||
return ((cnt && customer.needList.size() != 0) ? denyService(customer) : "Äîáðî ïîæàëîâàòü\n");
|
||||
};
|
||||
};
|
||||
|
||||
|
|
@ -0,0 +1 @@
|
|||
#include "Enums.h"
|
||||
|
|
@ -0,0 +1,88 @@
|
|||
#pragma once
|
||||
enum JobTitle {
|
||||
Receptionist,
|
||||
BankTeller,
|
||||
Cashier,
|
||||
Security,
|
||||
Manager,
|
||||
};
|
||||
|
||||
inline const char* jobTitleConverter(JobTitle jobTitle)
|
||||
{
|
||||
switch (jobTitle)
|
||||
{
|
||||
case Receptionist: return "Ðåñåïøèîíèñò";
|
||||
case BankTeller: return "Îïåðàöèîíèñò";
|
||||
case Cashier: return "Êàññèð";
|
||||
case Security: return "Îõðàííèê";
|
||||
case Manager: return "Óïðàâëÿþùèé";
|
||||
default: return "Áåçðàáîòíûé";
|
||||
}
|
||||
}
|
||||
|
||||
enum Need {
|
||||
GetLoan,
|
||||
GetCard,
|
||||
OpenDeposit,
|
||||
Invest,
|
||||
MakePayment,
|
||||
MakeTransfer,
|
||||
ExchangeCurrency,
|
||||
UnknownNeed
|
||||
};
|
||||
inline const char* needConverter(Need need)
|
||||
{
|
||||
switch (need)
|
||||
{
|
||||
case GetLoan: return "Çàíÿòü äåíüãè";
|
||||
case GetCard: return "Ïîëó÷èòü êàðòó";
|
||||
case OpenDeposit: return "Îòêðûòü âêëàä";
|
||||
case Invest: return "Èíâåñòèðîâàòü";
|
||||
case MakePayment: return "Îïëàòèòü";
|
||||
case MakeTransfer: return "Ïåðåâåñòè";
|
||||
case ExchangeCurrency: return "Îáìåíÿòü";
|
||||
case UnknownNeed: return "Íåèçâåñòíî";
|
||||
default: return "Óëûáàòüñÿ";
|
||||
}
|
||||
}
|
||||
|
||||
enum PropertyType {
|
||||
Land,
|
||||
House,
|
||||
Townhose,
|
||||
Appartment,
|
||||
UnknownPropertyType
|
||||
};
|
||||
|
||||
inline const char* propertyTypeConverter(PropertyType propertyType)
|
||||
{
|
||||
switch (propertyType)
|
||||
{
|
||||
case Land: return "Çåìåëüíûé ó÷àñòîê";
|
||||
case House: return "Äîì";
|
||||
case Townhose: return "Òàóíõàóñ";
|
||||
case Appartment: return "Êâàðòèðà";
|
||||
case UnknownPropertyType: return "Íåèçâåñòíûé òèï íåäâèæèìîñòè";
|
||||
default: return "Âîçäóõ";
|
||||
}
|
||||
}
|
||||
|
||||
enum Currency
|
||||
{
|
||||
RUB,
|
||||
USD,
|
||||
EUR,
|
||||
BGN
|
||||
};
|
||||
|
||||
inline const char* currencyConverter(Currency currency)
|
||||
{
|
||||
switch (currency)
|
||||
{
|
||||
case RUB: return "Ðîññèéñêèé ðóáëü";
|
||||
case USD: return "Àìåðèêàíñêèé äîëëàð";
|
||||
case EUR: return "Åâðî";
|
||||
case BGN: return "Áîëãàðñêèé ëåâ";
|
||||
default: return "Äåíüãè";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
#include "Insurance.h"
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
#pragma once
|
||||
class Insurance
|
||||
{
|
||||
public:
|
||||
unsigned long long amount = 0;
|
||||
unsigned int durationInMonths = 0;
|
||||
Insurance() = default;
|
||||
Insurance(
|
||||
unsigned long long amount,
|
||||
unsigned int durationInMonths
|
||||
) {
|
||||
this->amount = amount;
|
||||
this->durationInMonths = durationInMonths;
|
||||
};
|
||||
void open() {};
|
||||
void close() {};
|
||||
};
|
||||
|
||||
|
|
@ -0,0 +1 @@
|
|||
#include "Investment.h"
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
#pragma once
|
||||
#include "Account.h"
|
||||
#include "Product.h"
|
||||
|
||||
class Investment : public Product
|
||||
{
|
||||
public:
|
||||
unsigned long long amount = 0;
|
||||
double percent = 0;
|
||||
Account account;
|
||||
|
||||
Investment() : Product("Èíâåñòèöèîííûé ïðîäóêò") {};
|
||||
Investment(
|
||||
bool isAvailable,
|
||||
unsigned long long amount,
|
||||
double percent,
|
||||
Account account
|
||||
) : Product(
|
||||
"Èíâåñòèöèîííûé ïðîäóêò",
|
||||
isAvailable
|
||||
) {
|
||||
this->amount = amount;
|
||||
this->percent = percent;
|
||||
this->account = account;
|
||||
};
|
||||
void rebalance() {};
|
||||
void invest(unsigned long long amount) {};
|
||||
void withdraw(unsigned long long amount) {};
|
||||
};
|
||||
|
||||
|
|
@ -0,0 +1 @@
|
|||
#include "Loan.h"
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
#pragma once
|
||||
#include "Account.h"
|
||||
|
||||
class Loan : public Product
|
||||
{
|
||||
public:
|
||||
Account account;
|
||||
unsigned long long amount = 0;
|
||||
double percent = 0;
|
||||
unsigned int durationInMonths = 0;
|
||||
|
||||
Loan(std::string name) : Product(name) {};
|
||||
Loan(
|
||||
std::string name,
|
||||
bool isAvailable,
|
||||
Account account,
|
||||
unsigned long long amount,
|
||||
double percent,
|
||||
unsigned int durationInMonths
|
||||
) : Product(
|
||||
name,
|
||||
isAvailable
|
||||
) {
|
||||
this->account = account;
|
||||
this->amount = amount;
|
||||
this->percent = percent;
|
||||
this->durationInMonths = durationInMonths;
|
||||
};
|
||||
|
||||
void refinancing() {};
|
||||
void payOff() {};
|
||||
void bankrupt() {};
|
||||
};
|
||||
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
#include <iostream>
|
||||
#include "Simulation.h"
|
||||
|
||||
int main() {
|
||||
setlocale(LC_ALL, "ru");
|
||||
Simulation simulation;
|
||||
simulation.execute();
|
||||
|
||||
simulation.executeTest();
|
||||
|
||||
system("pause");
|
||||
return 0;
|
||||
};
|
||||
|
|
@ -0,0 +1 @@
|
|||
#include "Mortgage.h"
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
#pragma once
|
||||
#include "Enums.h"
|
||||
#include "Loan.h"
|
||||
|
||||
class Mortgage : public Loan
|
||||
{
|
||||
public:
|
||||
PropertyType property = PropertyType::Appartment;
|
||||
double discount = 0;
|
||||
Mortgage() : Loan("Èïîòåêà") {};
|
||||
Mortgage(
|
||||
bool isAvailable,
|
||||
Account account,
|
||||
unsigned long long amount,
|
||||
double percent,
|
||||
unsigned int durationInMonths,
|
||||
PropertyType property
|
||||
) : Loan(
|
||||
"Èïîòåêà",
|
||||
isAvailable,
|
||||
account,
|
||||
amount,
|
||||
percent,
|
||||
durationInMonths
|
||||
) {
|
||||
this->property = property;
|
||||
};
|
||||
void applyDiscount(
|
||||
double discount
|
||||
) {
|
||||
this->discount = discount;
|
||||
};
|
||||
std::string executeTest() {
|
||||
return (this->property == UnknownPropertyType) ? \
|
||||
"Îòêàçàíî â èïîòåêå, íå ïîääåðæèâàåìûé òèï íåäâèæèìîñòè\n" : \
|
||||
"Èïîòåêà îäîáðåíà\n";
|
||||
};
|
||||
};
|
||||
|
||||
|
|
@ -0,0 +1 @@
|
|||
#include "Payment.h"
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
#pragma once
|
||||
#include "Transaction.h"
|
||||
|
||||
class Payment :
|
||||
public Transaction
|
||||
{
|
||||
public:
|
||||
std::string purpose = "";
|
||||
unsigned int MCCCode = 0;
|
||||
Payment() : Transaction("Ïëàò¸æ") {};
|
||||
Payment(
|
||||
bool isAvailable,
|
||||
AccountRequisites payerRequisites,
|
||||
AccountRequisites recipientRequisites,
|
||||
unsigned long long amount,
|
||||
unsigned int date,
|
||||
std::string purpose,
|
||||
unsigned int MCCCode
|
||||
) : Transaction(
|
||||
"Ïëàò¸æ",
|
||||
isAvailable,
|
||||
payerRequisites,
|
||||
recipientRequisites,
|
||||
amount,
|
||||
date
|
||||
) {
|
||||
this->purpose = purpose;
|
||||
this->MCCCode = MCCCode;
|
||||
};
|
||||
};
|
||||
|
||||
|
|
@ -0,0 +1 @@
|
|||
#include "Person.h"
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
#pragma once
|
||||
#include <string>
|
||||
|
||||
class Person
|
||||
{
|
||||
public:
|
||||
std::string name = "";
|
||||
Person() = default;
|
||||
Person(std::string name) {
|
||||
this->name = name;
|
||||
};
|
||||
std::string communicate(Person person) {
|
||||
return (this->name + " îáùàåòñÿ ñ " + person.name + "\n");
|
||||
};
|
||||
|
||||
std::string greet(Person person) {
|
||||
return (this->name + " ïðèâåòñòâóåò " + person.name + "\n");
|
||||
};
|
||||
};
|
||||
|
||||
|
|
@ -0,0 +1 @@
|
|||
#include "Product.h"
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
#pragma once
|
||||
#include <string>
|
||||
|
||||
class Product
|
||||
{
|
||||
public:
|
||||
std::string productName = "";
|
||||
bool isAvailable = true;
|
||||
Product() = default;
|
||||
Product(std::string name) {
|
||||
this->productName = name;
|
||||
};
|
||||
Product(std::string name, bool isAvailable) {
|
||||
this->productName = name;
|
||||
this->isAvailable = isAvailable;
|
||||
}
|
||||
void open() {
|
||||
this->isAvailable = true;
|
||||
}
|
||||
void close() {
|
||||
this->isAvailable = false;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -0,0 +1 @@
|
|||
#include "Simulation.h"
|
||||
|
|
@ -0,0 +1,352 @@
|
|||
#pragma once
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include "BankBranch.h"
|
||||
#include "Employee.h"
|
||||
#include "Enums.h"
|
||||
#include "Customer.h"
|
||||
#include "Account.h"
|
||||
#include "AccountRequisites.h"
|
||||
#include "ConsumerLoan.h"
|
||||
#include "CarLoan.h"
|
||||
#include "Mortgage.h"
|
||||
#include "Card.h"
|
||||
#include "Cash.h"
|
||||
#include "Transaction.h"
|
||||
#include "Payment.h"
|
||||
#include "CurrencyExchange.h"
|
||||
#include "Deposit.h"
|
||||
#include "Investment.h"
|
||||
|
||||
class Simulation
|
||||
{
|
||||
private:
|
||||
|
||||
WorkingHours workingHours = WorkingHours(
|
||||
9,
|
||||
17
|
||||
);
|
||||
Address addressHeadquarter = Address(
|
||||
"Ðîññèÿ",
|
||||
"Ìîñêîâñêàÿ îáëàñòü",
|
||||
"Ìîñêâà",
|
||||
101000,
|
||||
"óëèöà ×àéíàÿ",
|
||||
1
|
||||
);
|
||||
Address addressBranch = Address(
|
||||
"Ðîññèÿ",
|
||||
"Ñàìàðñêàÿ îáëàñòü",
|
||||
"Òîëüÿòòè",
|
||||
445030,
|
||||
"áóëüâàð Çîëîòèñòûé",
|
||||
1
|
||||
);
|
||||
Address foreignBankAddress = Address(
|
||||
"Áîëãàðèÿ",
|
||||
"Âàðíåíñêàÿ îáëàñòü",
|
||||
"Âàðíà",
|
||||
9000,
|
||||
"áóëüâàð Ñëèâíèöà",
|
||||
43
|
||||
);
|
||||
BankRequisites bankRequisites = BankRequisites(
|
||||
"Áàíê Çîëîòàÿ ×àøà",
|
||||
123456789,
|
||||
10101810000000000000,
|
||||
121212121212,
|
||||
565656565,
|
||||
32323232,
|
||||
1122334455667,
|
||||
"GLDRRUMM",
|
||||
addressHeadquarter,
|
||||
addressBranch
|
||||
);
|
||||
BankRequisites foreignBankRequisites = BankRequisites(
|
||||
"Áàíê ×åðåí Ïåïåð",
|
||||
1234999989,
|
||||
10221421700000000000,
|
||||
121233321212,
|
||||
565659995,
|
||||
32999232,
|
||||
1122334495667,
|
||||
"CHPRRUMM",
|
||||
foreignBankAddress
|
||||
);
|
||||
|
||||
BankBranch bankBranch = BankBranch(
|
||||
workingHours,
|
||||
bankRequisites
|
||||
);
|
||||
|
||||
Employee receptionist = Employee(
|
||||
"Àëëà Ïóãà÷åâà",
|
||||
Receptionist
|
||||
);
|
||||
Employee bankTeller = Employee(
|
||||
"Âåðêà Ñåðäþ÷êà",
|
||||
BankTeller
|
||||
);
|
||||
Employee cashier = Employee(
|
||||
"Èðèíà Àëëåãðîâà",
|
||||
Cashier
|
||||
);
|
||||
Employee security = Employee(
|
||||
"Ñòàñ Ìèõàéëîâ",
|
||||
Security
|
||||
);
|
||||
Employee manager = Employee(
|
||||
"Íèêîëàé Áàñêîâ",
|
||||
Manager
|
||||
);
|
||||
Customer customer = Customer(
|
||||
"Ôèëèïï Êèðêîðîâ",
|
||||
{
|
||||
GetLoan,
|
||||
GetCard,
|
||||
MakePayment,
|
||||
MakeTransfer,
|
||||
ExchangeCurrency
|
||||
}
|
||||
);
|
||||
AccountRequisites accountRequisites = AccountRequisites(
|
||||
customer.name,
|
||||
121212121212123,
|
||||
bankRequisites
|
||||
);
|
||||
AccountRequisites recipientRequisites = AccountRequisites(
|
||||
"ÎÎÎ Æèâè Öâåòÿ",
|
||||
32323232323233,
|
||||
foreignBankRequisites
|
||||
);
|
||||
AccountRequisites foreignRequisites = AccountRequisites(
|
||||
customer.name,
|
||||
32323232323233,
|
||||
foreignBankRequisites
|
||||
);
|
||||
Account account = Account(
|
||||
true,
|
||||
0,
|
||||
accountRequisites
|
||||
);
|
||||
ConsumerLoan consumerLoan = ConsumerLoan(
|
||||
true,
|
||||
account,
|
||||
1000000,
|
||||
6.9,
|
||||
420,
|
||||
"Ìèëëèîí Àëûõ Ðîç"
|
||||
);
|
||||
Card card = Card(
|
||||
true,
|
||||
account,
|
||||
123123123123,
|
||||
customer.name,
|
||||
3000,
|
||||
123
|
||||
);
|
||||
Transaction transaction = Transaction(
|
||||
true,
|
||||
accountRequisites,
|
||||
foreignRequisites,
|
||||
500000,
|
||||
time(0)
|
||||
);
|
||||
Payment payment = Payment(
|
||||
true,
|
||||
accountRequisites,
|
||||
recipientRequisites,
|
||||
300000,
|
||||
time(0),
|
||||
"Ìèëëèîí Àëûõ Ðîç",
|
||||
6969
|
||||
);
|
||||
CurrencyExchange currencyExchange = CurrencyExchange(
|
||||
true,
|
||||
accountRequisites,
|
||||
accountRequisites,
|
||||
100000,
|
||||
time(0),
|
||||
Currency::RUB,
|
||||
Currency::BGN
|
||||
);
|
||||
Deposit deposit = Deposit(
|
||||
true,
|
||||
account,
|
||||
50000
|
||||
);
|
||||
Investment investment = Investment(
|
||||
true,
|
||||
50000,
|
||||
9,
|
||||
account
|
||||
);
|
||||
|
||||
void init() {
|
||||
bankBranch.productList.push_back(Account());
|
||||
bankBranch.productList.push_back(Card());
|
||||
bankBranch.productList.push_back(Mortgage());
|
||||
bankBranch.productList.push_back(ConsumerLoan());
|
||||
bankBranch.productList.push_back(CarLoan());
|
||||
bankBranch.productList.push_back(Deposit());
|
||||
bankBranch.productList.push_back(Investment());
|
||||
bankBranch.productList.push_back(Transaction());
|
||||
bankBranch.productList.push_back(Payment());
|
||||
bankBranch.productList.push_back(Cash());
|
||||
bankBranch.productList.push_back(CurrencyExchange());
|
||||
|
||||
bankBranch.employeeList.push_back(receptionist);
|
||||
bankBranch.employeeList.push_back(security);
|
||||
bankBranch.employeeList.push_back(bankTeller);
|
||||
bankBranch.employeeList.push_back(cashier);
|
||||
bankBranch.employeeList.push_back(manager);
|
||||
|
||||
};
|
||||
|
||||
public:
|
||||
Simulation() = default;
|
||||
|
||||
void executeTest() {
|
||||
init();
|
||||
|
||||
std::cout << "============testcase START=============\n";
|
||||
std::cout << "============testcase1=============\n";
|
||||
std::cout << "\nÐåæèì ðàáîòû: ñ " << bankBranch.workingHours.getFrom()
|
||||
<< " äî " << bankBranch.workingHours.getTo() << "\n";
|
||||
std::cout << "Â äàííîå âðåìÿ áàíê " << (bankBranch.isWorkingNow() ? \
|
||||
"ðàáîòàåò.\n\n" : "íå ðàáîòàåò.\n\n");
|
||||
|
||||
std::cout << "============testcase2=============\n";
|
||||
Customer customerWithUnknownNeed = Customer(
|
||||
"Ãðèãîðèé",
|
||||
{UnknownNeed}
|
||||
);
|
||||
std::cout << receptionist.executeTest(customerWithUnknownNeed);
|
||||
|
||||
std::cout << "============testcase3=============\n";
|
||||
CurrencyExchange denyCurrencyExchange = CurrencyExchange(
|
||||
true,
|
||||
accountRequisites,
|
||||
accountRequisites,
|
||||
100,
|
||||
time(0),
|
||||
RUB,
|
||||
USD
|
||||
);
|
||||
std::cout << denyCurrencyExchange.executeTest();
|
||||
|
||||
std::cout << "============testcase4=============\n";
|
||||
Mortgage denyMortgage = Mortgage(
|
||||
true,
|
||||
account,
|
||||
1000000,
|
||||
10,
|
||||
120,
|
||||
UnknownPropertyType
|
||||
);
|
||||
std::cout << denyMortgage.executeTest();
|
||||
|
||||
std::cout << "============testcase5=============\n";
|
||||
Account noSufficientFundAccount = Account(
|
||||
true,
|
||||
10,
|
||||
accountRequisites
|
||||
);
|
||||
Transaction noSufficientFundTransaction = Transaction(
|
||||
true,
|
||||
accountRequisites,
|
||||
foreignRequisites,
|
||||
500000,
|
||||
time(0)
|
||||
);
|
||||
std::cout << noSufficientFundTransaction.executeTest(noSufficientFundAccount);
|
||||
std::cout << "============testcase END=============\n";
|
||||
};
|
||||
|
||||
void execute() {
|
||||
init();
|
||||
std::cout << "============1=============\n";
|
||||
std::cout << "Ôèëèàë " << bankBranch.bankRequisites.bankName << "\n";
|
||||
std::cout << "Ðàñïîëàãàåòñÿ ïî àäðåñó: Ãîðîä " <<
|
||||
bankBranch.bankRequisites.addressSub.city <<
|
||||
", " << bankBranch.bankRequisites.addressSub.street <<
|
||||
", äîì " << bankBranch.bankRequisites.addressSub.building << "\n";
|
||||
|
||||
std::cout << "\nÏðåäëàãàåò ñëåäóþùèå ïðîäóêòû è óñëóãè:\n";
|
||||
for (Product product : bankBranch.productList)
|
||||
{
|
||||
std::cout << product.productName << "\n";
|
||||
};
|
||||
std::cout << "\nÐåæèì ðàáîòû: ñ " << bankBranch.workingHours.getFrom() << " äî "
|
||||
<< bankBranch.workingHours.getTo() << "\n";
|
||||
std::cout << "Â äàííîå âðåìÿ áàíê " << (bankBranch.isWorkingNow() ? "ðàáîòàåò.\n\n" : "íå ðàáîòàåò.\n\n");
|
||||
|
||||
std::cout << "Ïåðñîíàë ôèëèàëà áàíêà: \n";
|
||||
for (Employee employee: bankBranch.employeeList) {
|
||||
std::cout << employee.name << " â äîëæíîñòè " << jobTitleConverter(employee.jobTitle) << "\n";
|
||||
};
|
||||
|
||||
std::cout << "\n============2=============\n";
|
||||
std::cout << "Êëèåíò è ðåñåïøèîíèñò ïðèâåòñòâóþò äðóã äðóãà: \n";
|
||||
std::cout << customer.greet(receptionist);
|
||||
std::cout << receptionist.greet(customer);
|
||||
std::cout << "\n============3=============\n";
|
||||
std::cout << "Êëèåíò îçâó÷èâàåò ïðè÷èíó âèçèòà: \n";
|
||||
std::cout << customer.askForHelp(GetLoan);
|
||||
std::cout << "\n============4=============\n";
|
||||
std::cout << "Ðåñåïøèîíèñò äåëåãèðóåò êëèåíòà îïåðàöèîíèñòó: \n";
|
||||
std::cout << receptionist.communicate(bankTeller);
|
||||
std::cout << "\n============5=============\n";
|
||||
std::cout << "Îïåðàöèîíèñò îçâó÷èâàåò áàíêîâñêèå ïðîäóêòû ñ çà¸ìíûìè ñðåäñòâàìè : \n";
|
||||
std::cout << bankTeller.offerHelp(customer, {Mortgage(),CarLoan(),ConsumerLoan()});
|
||||
std::cout << "\n============6=============\n";
|
||||
std::cout << "Êëèåíò îçâó÷èâàåò öåëü êðåäèòà: \n";
|
||||
std::cout << customer.askForHelp("Ìèëëèîí àëûõ ðîç\n");
|
||||
std::cout << "\n============7=============\n";
|
||||
std::cout << "Îïåðàöèîíèñò ïðîâîäèò èäåíòèôèêàöèþ êëèåíòà: \n";
|
||||
std::cout << bankTeller.auth(customer);
|
||||
std::cout << "\n============8=============\n";
|
||||
std::cout << "Îïåðàöèîíèñò çàâîäèò áàíêîâñêèå ïðîäóêòû: \n";
|
||||
std::cout << "Ñ÷åò ñ íîìåðîì: \n";
|
||||
std::cout << account.accountRequisites.accountNumber << "\n";
|
||||
std::cout << "Ïîòðåáèòåëüñêèé êðåäèò íà ñóììó: \n";
|
||||
std::cout << consumerLoan.amount << "\n";
|
||||
account.balance += consumerLoan.amount;
|
||||
std::cout << "Áàíêîâñêàÿ êàðòà ñ íîìåðîì: \n";
|
||||
std::cout << card.number << "\n";
|
||||
std::cout << "\n============9=============\n";
|
||||
std::cout << "Êëèåíò â êàññå: \n";
|
||||
std::cout << "1. Ñîâåðøàåò ïëàòåæ íà ñóììó: \n";
|
||||
account.balance -= payment.amount;
|
||||
std::cout << payment.amount << "\n";
|
||||
std::cout << "â ïîëüçó: \n";
|
||||
std::cout << payment.recipientRequisites.owner << "\n";
|
||||
std::cout << "2. Ñîâåðøàåò ïåðåâîä íà ñóììó: \n";
|
||||
account.balance -= transaction.amount;
|
||||
std::cout << transaction.amount << "\n";
|
||||
std::cout << "íà ñâîé ñ÷åò â áîëãàðñêèé áàíê: \n";
|
||||
std::cout << transaction.recipientRequisites.bankRequisites.bankName << "\n";
|
||||
std::cout << "3. Ïðèîáðåòàåò âàëþòó: \n";
|
||||
account.balance -= currencyExchange.amount;
|
||||
std::cout << currencyConverter(currencyExchange.currencyTo) << "\n";
|
||||
std::cout << "íà ñóììó: \n";
|
||||
std::cout << currencyExchange.amount << "\n";
|
||||
std::cout << "Íà ñ÷åòó êëèåíòà îñòàåòñÿ çà¸ìíûõ ñðåäñòâ â ðàçìåðå: \n";
|
||||
std::cout << cashier.getBalanceRemainder(account) << "\n";
|
||||
std::cout << "\n============10=============\n";
|
||||
std::cout << "Óïðàâëÿþùèé áàíêà ïðåäëàãàåò âëîæèòü ñðåäñòâà: \n";
|
||||
std::cout << manager.offerHelp(customer, {Deposit(), Investment()}) << "\n";
|
||||
std::cout << "Îòêðûâàåòñÿ âêëàä íà ñóììó: \n";
|
||||
std::cout << deposit.amount << "\n";
|
||||
account.balance -= deposit.amount;
|
||||
std::cout << "Îòêðûâàåòñÿ èíâåñòèöèîííûé ïðîäóêò íà ñóììó: \n";
|
||||
std::cout << investment.amount << "\n";
|
||||
account.balance -= investment.amount;
|
||||
std::cout << "\n============11=============\n";
|
||||
std::cout << "Êëèåíò ïîêèäàÿ ôèëèàë áàíêà, ñëûøèò âñëåä: \n";
|
||||
std::cout << receptionist.communicate(customer) << "\n";
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1 @@
|
|||
#include "Transaction.h"
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
#pragma once
|
||||
#include "Product.h"
|
||||
#include "AccountRequisites.h"
|
||||
#include <string>
|
||||
#include "Account.h"
|
||||
|
||||
class Transaction : public Product
|
||||
{
|
||||
public:
|
||||
AccountRequisites payerRequisites;
|
||||
AccountRequisites recipientRequisites;
|
||||
unsigned long long amount = 0;
|
||||
unsigned int date = 0;
|
||||
|
||||
Transaction() : Product("Äåíåæíûå ïåðåâîäû") {};
|
||||
Transaction(std::string name): Product (name) {};
|
||||
Transaction(
|
||||
std::string name,
|
||||
bool isAvailable,
|
||||
AccountRequisites payerRequisites,
|
||||
AccountRequisites recipientRequisites,
|
||||
unsigned long long amount,
|
||||
unsigned int date
|
||||
) : Product(
|
||||
name,
|
||||
isAvailable
|
||||
) {
|
||||
this->payerRequisites = payerRequisites;
|
||||
this->recipientRequisites = recipientRequisites;
|
||||
this->amount = amount;
|
||||
this->date = date;
|
||||
};
|
||||
Transaction(
|
||||
bool isAvailable,
|
||||
AccountRequisites payerRequisites,
|
||||
AccountRequisites recipientRequisites,
|
||||
unsigned long long amount,
|
||||
unsigned int date
|
||||
) : Product(
|
||||
"Äåíåæíûå ïåðåâîäû",
|
||||
isAvailable
|
||||
) {
|
||||
this->payerRequisites = payerRequisites;
|
||||
this->recipientRequisites = recipientRequisites;
|
||||
this->amount = amount;
|
||||
this->date = date;
|
||||
};
|
||||
void execute() {};
|
||||
void cancel() {};
|
||||
std::string executeTest(Account account) {
|
||||
return ((account.balance < this->amount) ? \
|
||||
"Îïåðàöèÿ îòêëîíåíà, íåäîñòàòî÷íî ñðåäñòâ\n" : \
|
||||
"Èñïîëíåíî\n");
|
||||
};
|
||||
};
|
||||
|
||||
|
|
@ -0,0 +1 @@
|
|||
#include "WorkingHours.h"
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
#pragma once
|
||||
#include <time.h>
|
||||
|
||||
class WorkingHours
|
||||
{
|
||||
private:
|
||||
unsigned int from = 0;
|
||||
unsigned int to = 0;
|
||||
public:
|
||||
WorkingHours() = default;
|
||||
WorkingHours(unsigned int from, unsigned int to) {
|
||||
this->from = from;
|
||||
this->to = to;
|
||||
};
|
||||
unsigned int getFrom() {
|
||||
return this->from;
|
||||
};
|
||||
unsigned int getTo() {
|
||||
return this->to;
|
||||
};
|
||||
};
|
||||
|
||||
Loading…
Reference in New Issue