First day
This commit is contained in:
22
Exercise1/StoreData/IAccount.cs
Normal file
22
Exercise1/StoreData/IAccount.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
namespace StoreData
|
||||
{
|
||||
public interface IAccount
|
||||
{
|
||||
/// <summary>
|
||||
/// Check the balance
|
||||
/// </summary>
|
||||
decimal Balance { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Add money to this account
|
||||
/// </summary>
|
||||
/// <param name="amount">The amount to add</param>
|
||||
void Add(decimal amount);
|
||||
|
||||
/// <summary>
|
||||
/// Remove money from this account
|
||||
/// </summary>
|
||||
/// <param name="amount">The amount to remove</param>
|
||||
void Remove(decimal amount);
|
||||
}
|
||||
}
|
||||
37
Exercise1/StoreData/IShoppingCart.cs
Normal file
37
Exercise1/StoreData/IShoppingCart.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace StoreData
|
||||
{
|
||||
public interface IShoppingCart
|
||||
{
|
||||
/// <summary>
|
||||
/// This method adds a product to the shopping cart
|
||||
/// </summary>
|
||||
/// <param name="p">The product to add</param>
|
||||
void AddProduct(Product p);
|
||||
|
||||
/// <summary>
|
||||
/// Remove product by number
|
||||
/// </summary>
|
||||
/// <param name="index">The index of the product to remove</param>
|
||||
void RemoveProductByNumber(int index);
|
||||
|
||||
/// <summary>
|
||||
/// Clears the entire shopping cart
|
||||
/// </summary>
|
||||
void Clear();
|
||||
|
||||
/// <summary>
|
||||
/// Calculate the sum of the cost of all products
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
decimal TotalSum();
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if cart is empty, otherwise false
|
||||
/// </summary>
|
||||
bool CartIsEmpty();
|
||||
|
||||
List<Product> Products { get; }
|
||||
}
|
||||
}
|
||||
8
Exercise1/StoreData/Product.cs
Normal file
8
Exercise1/StoreData/Product.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
namespace StoreData
|
||||
{
|
||||
public class Product
|
||||
{
|
||||
public decimal Price { get; set; }
|
||||
public string Name { get; set; }
|
||||
}
|
||||
}
|
||||
33
Exercise1/StoreData/Properties/AssemblyInfo.cs
Normal file
33
Exercise1/StoreData/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("StoreData.Properties")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("StoreData.Properties")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2015")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("7A332E26-38F4-4649-B445-3BAFDBD15431")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
56
Exercise1/StoreData/StoreData.csproj
Normal file
56
Exercise1/StoreData/StoreData.csproj
Normal file
@@ -0,0 +1,56 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>8.0.30703</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{A3587AB8-ED1A-4C9F-9981-42863DB18AF9}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>StoreData</RootNamespace>
|
||||
<AssemblyName>StoreData</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="IAccount.cs" />
|
||||
<Compile Include="IShoppingCart.cs" />
|
||||
<Compile Include="Product.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
Reference in New Issue
Block a user