Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions CashRegister/CashRegister.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28307.902
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CashRegister", "CashRegister\CashRegister.csproj", "{B1530C03-3E17-4F02-860C-8DCAC32552FB}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{B1530C03-3E17-4F02-860C-8DCAC32552FB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B1530C03-3E17-4F02-860C-8DCAC32552FB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B1530C03-3E17-4F02-860C-8DCAC32552FB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B1530C03-3E17-4F02-860C-8DCAC32552FB}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {8C0CC773-9382-4040-8047-EA3EEB4CFF98}
EndGlobalSection
EndGlobal
6 changes: 6 additions & 0 deletions CashRegister/CashRegister/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
</configuration>
66 changes: 66 additions & 0 deletions CashRegister/CashRegister/CashRegister.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{B1530C03-3E17-4F02-860C-8DCAC32552FB}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>CashRegister</RootNamespace>
<AssemblyName>CashRegister</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<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' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<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.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Model\Transcation.cs" />
<Compile Include="obj\Debug\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs" />
<Compile Include="obj\Debug\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs" />
<Compile Include="obj\Debug\TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="bin\Debug\CashRegister.exe.config" />
</ItemGroup>
<ItemGroup>
<Content Include="bin\Debug\CashRegister.exe" />
<Content Include="bin\Debug\CashRegister.pdb" />
<Content Include="bin\Debug\TranscationFile\transcations.txt" />
</ItemGroup>
<ItemGroup>
<Folder Include="bin\Release\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
6 changes: 6 additions & 0 deletions CashRegister/CashRegister/CashRegister.csproj.user
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectView>ShowAllFiles</ProjectView>
</PropertyGroup>
</Project>
14 changes: 14 additions & 0 deletions CashRegister/CashRegister/Model/Transcation.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CashRegister.Model
{
public class TranscationModel
{
public int Payment { get; set; }
public int Purchase { get; set; }
}
}
91 changes: 91 additions & 0 deletions CashRegister/CashRegister/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
using CashRegister.Model;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CashRegister
{
class Program
{
public static void Main(string[] args)
{
CashRegisterApp();
}




public static void CashRegisterApp()
{
List<TranscationModel> trans = new List<TranscationModel>();
string fileName = "transcations.txt";
string filePath = Path.Combine(Environment.CurrentDirectory, @"TranscationFile\", fileName);

using (var reader = new StreamReader(filePath))
{
while (!reader.EndOfStream)
{
var line = reader.ReadLine();
var values = line.Split(',');
int pur = Convert.ToInt32(values[0].Replace(".", ""));
int pay = Convert.ToInt32(values[1].Replace(".", ""));
trans.Add(new TranscationModel { Payment = pay, Purchase= pur });
}
}

foreach (var tran in trans)
{
int payment = tran.Payment; //$5.00
int purchase = tran.Purchase; //$2.68
int change = payment - purchase;
int changeincents = change * 100;
bool israndom = (changeincents % 3) == 0;

if (change == 0)
{
Console.WriteLine("No Change to be dispensed");
}

if (change < 0)
{
Console.WriteLine("Insufficient Funds");
}

else if (israndom == true && changeincents > 0)
{

Random random = new Random();
decimal ranchange = change;

var denoms = new[] { // ordered
new { name = "dollar", nominal = 100m },
new { name = "quarter", nominal = 0.25m },
new { name = "dime", nominal = 0.10m },
new { name = "nickel", nominal = 0.05m },
new { name = "pennies", nominal = 0.01m }
};

Console.WriteLine("Your random change is " + random.Next(3) + " dollar(s) " + random.Next(3) + " quarter(s) " + random.Next(3) + " dime(s) " + random.Next(3) + " nickle(s) " + random.Next(3) + " and " + random.Next(3) + " penn(ies)");


}
else if (changeincents > 0)
{
int dollars = change / 100;
change = change % 100;
int quarters = change / 25;
change = change % 25;
int dimes = change / 10;
change = change % 10;
int nickles = change / 5;
int pennies = change % 1;
Console.WriteLine("Your change is " + dollars + " dollar(s) " + quarters + " quarter(s) " + dimes + " dime(s) " + nickles + " nickle(s), and " + pennies + " pennie(s).");
}
}
Console.ReadLine();
}
}
}
36 changes: 36 additions & 0 deletions CashRegister/CashRegister/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
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("CashRegister")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CashRegister")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[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("b1530c03-3e17-4f02-860c-8dcac32552fb")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
Binary file not shown.
6 changes: 6 additions & 0 deletions CashRegister/CashRegister/bin/Debug/CashRegister.exe.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
</configuration>
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
2.12,3.00
1.97,2.00
3.33,5.00
12.99, 12.99
15.20, 15.00
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cec696cedcc266259b3910b25ac5456a17346403
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
C:\Users\umufti\source\repos\CashRegister\CashRegister\bin\Debug\CashRegister.exe.config
C:\Users\umufti\source\repos\CashRegister\CashRegister\bin\Debug\CashRegister.exe
C:\Users\umufti\source\repos\CashRegister\CashRegister\bin\Debug\CashRegister.pdb
C:\Users\umufti\source\repos\CashRegister\CashRegister\obj\Debug\CashRegister.csprojAssemblyReference.cache
C:\Users\umufti\source\repos\CashRegister\CashRegister\obj\Debug\CashRegister.csproj.CoreCompileInputs.cache
C:\Users\umufti\source\repos\CashRegister\CashRegister\obj\Debug\CashRegister.exe
C:\Users\umufti\source\repos\CashRegister\CashRegister\obj\Debug\CashRegister.pdb
C:\Users\pkumar\Documents\CashRegister\CashRegister\CashRegister\bin\Debug\CashRegister.exe.config
C:\Users\pkumar\Documents\CashRegister\CashRegister\CashRegister\bin\Debug\CashRegister.exe
C:\Users\pkumar\Documents\CashRegister\CashRegister\CashRegister\bin\Debug\CashRegister.pdb
C:\Users\pkumar\Documents\CashRegister\CashRegister\CashRegister\obj\Debug\CashRegister.csprojAssemblyReference.cache
C:\Users\pkumar\Documents\CashRegister\CashRegister\CashRegister\obj\Debug\CashRegister.csproj.CoreCompileInputs.cache
C:\Users\pkumar\Documents\CashRegister\CashRegister\CashRegister\obj\Debug\CashRegister.exe
C:\Users\pkumar\Documents\CashRegister\CashRegister\CashRegister\obj\Debug\CashRegister.pdb
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.