CITP4350/.vs/CITP4350/DesignTimeBuild/.dtbcache.v2
CITP4350/.vs/CITP4350/v16/.suo
CITP4350
in/Debug/netcoreapp3.1/CITP4350.deps.json
{
"runtimeTarget": {
"name": ".NETCoreApp,Version=v3.1",
"signature": ""
},
"compilationOptions": {},
"targets": {
".NETCoreApp,Version=v3.1": {
"CITP4350/1.0.0": {
"runtime": {
"CITP4350.dll": {}
}
}
}
},
"li
aries": {
"CITP4350/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
}
}
}
CITP4350
in/Debug/netcoreapp3.1/CITP4350.dll
CITP4350
in/Debug/netcoreapp3.1/CITP4350.exe
CITP4350
in/Debug/netcoreapp3.1/CITP4350.pd
CITP4350
in/Debug/netcoreapp3.1/CITP4350.runtimeconfig.dev.json
{
"runtimeOptions": {
"additionalProbingPaths": [
"C:\\Users\\Aditya\\.dotnet\\store\\|arch|\\|tfm|",
"C:\\Users\\Aditya\\.nuget\\packages"
]
}
}
CITP4350
in/Debug/netcoreapp3.1/CITP4350.runtimeconfig.json
{
"runtimeOptions": {
"tfm": "netcoreapp3.1",
"framework": {
"name": "Microsoft.NETCore.App",
"version": "3.1.0"
}
}
}
CITP4350
in/Debug/netcoreapp3.1/customerBill.txt
CITP4350
in/Debug/netcoreapp3.1/inventory.txt
Perfume,50,2555
Sanitiser,20,92
Soap,10,200
Chips,10,250
Soda,25,100
Choclate,40,80
Biscuits,15,200
Ice Cream,20,100
CITP4350/CITP4350.csproj
Project Sdk="Microsoft.NET.Sdk"
Exe
OutputType
netcoreapp3.1
TargetFramework
PropertyGroup
Project
CITP4350/CITP4350.sln
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30517.126
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CITP4350", "CITP4350.csproj", "{026E0634-C195-43C6-AF9F-C5274EB7748A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{026E0634-C195-43C6-AF9F-C5274EB7748A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{026E0634-C195-43C6-AF9F-C5274EB7748A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{026E0634-C195-43C6-AF9F-C5274EB7748A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{026E0634-C195-43C6-AF9F-C5274EB7748A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {B384490B-64ED-4D66-8EB3-8B46AEC452F7}
EndGlobalSection
EndGlobal
CITP4350/Customer.cs
using System;
using System.Collections.Generic;
using System.Text;
namespace CITP4350
{
class Custome
{
private int customerID;
private string name;
private string address;
private int age;
private string number;
private static int autoId = 2001;
private List products;
public Customer(string name, string address, int age, string number)
{
this.customerID = autoId;
this.name = name;
this.address = address;
this.age = age;
this.number = number;
autoId++;
products = new List();
}
public int getCustomerID()
{
return customerID;
}
public void buyProduct(Product product)
{
products.Add(product);
}
public double getDuscountAmount(double subTotalAmount)
{
double amount = 0;
if (subTotalAmount > 50 && subTotalAmount <= 150)
{
amount = 0.05 * subTotalAmount;
}
else if (subTotalAmount > 150 && subTotalAmount <= 250)
{
amount = 0.1 * subTotalAmount;
}
else if (subTotalAmount > 250 && subTotalAmount <= 350)
{
amount = 0.15 * subTotalAmount;
}
else if (subTotalAmount > 350)
{
amount = 0.2 * subTotalAmount;
}
return amount;
}
public String getFileData()
{
double totalPrice;
double subTotal = 0;
double disountAmount = 0;
for (int i = 0; i < products.Count; i++)
{
Product p = products[i];
subTotal = subTotal + p.getTotalPrice();
}
disountAmount = getDuscountAmount(subTotal);
double taxAmount = 0.12 * subTotal;
totalPrice = subTotal + taxAmount - disountAmount;
string data = "Customer Id: "+customerID+"\nCustomer Name: "+name+"\nContact Number: "+number+"\nBill Information\nSubTotal Amount: "+subTotal+"\nDiscount Amount: "+disountAmount+"\nTax Amount: "+taxAmount+"\nTotal Amount: "+totalPrice;
return data;
}
public void generateBill()
{
double totalPrice;
double subTotal = 0;
double disountAmount = 0;
Console.WriteLine("---------------------------------------------------------");
Console.WriteLine("Customer ID: "+customerID);
Console.WriteLine("Customer Name: " + name);
Console.WriteLine("Contact Number: " + number);
Console.WriteLine("Products Bought");
for (int i =0;i {
Product p = products[i];
Console.WriteLine("Product Id: "+p.getProductId());
Console.WriteLine("Product Name: " + p.getProductName());
Console.WriteLine("Price: " + p.getPrice());
Console.WriteLine("Quantity: "+p.getQuantity());
Console.WriteLine("Product Total Amount: " + p.getTotalPrice());
subTotal = subTotal + p.getTotalPrice();
}
disountAmount = getDuscountAmount(subTotal);
double taxAmount = 0.12 * subTotal;
totalPrice = subTotal + taxAmount - disountAmount;
Console.WriteLine("\nSub Total Amount: " + subTotal);
Console.WriteLine("Discount Amount: " + disountAmount);
Console.WriteLine("Tax Amount: " + taxAmount);
Console.WriteLine("Total Amount: "+totalPrice);
Console.WriteLine("---------------------------------------------------------");
}
}
}
CITP4350/inventory.txt
Perfume,50,200
Sanitiser,20,100
Soap,10,200
Chips,10,250
Soda,25,100
Choclate,40,80
Biscuits,15,200
Ice Cream,20,100
CITP4350/Manager.cs
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
namespace CITP4350
{
class Manage
{
private List customers;
private List products;
private static Manager manager = null;
private Manager()
{
customers = new List();
products = new List();
readProductInformation();
}
private void readProductInformation()
{
string fileName = "inventory.txt";
using (StreamReader reader = new StreamReader(fileName))
{
string line;
while ((line = reader.ReadLine()) != null)
{
string[] a
= line.Split(",");
string productName = a
[0];
double price = Convert.ToDouble(a
[1]);
int quantity = Convert.ToInt32(a
[2]);
Product product = new Product(productName,price,quantity);
products.Add(product);
}
}
}
public void saveCustomerBill()
{
string fileName = "customerBill.txt";
using (StreamWriter file = new StreamWriter(fileName))
{
for (int i = 0; i < customers.Count; i++)
{
file.Write(customers[i].getFileData() + "\n\n");
}
}
}
public void updateInventory()
{
string fileName = "inventory.txt";
using (StreamWriter file = new StreamWriter(fileName))
{
for (int i=0;i {
file.Write(products[i].writeFileData()+"\n");
}
}
}
private int checkCustomerId(int...