Professional Documents
Culture Documents
OOP Project Report 107,102,259,148,103
OOP Project Report 107,102,259,148,103
APPLICATION: CHEETAHMART
FEATURES:
• Login Form in Which User Has to Login Before Accessing the Main Menu.
Some Preset Accounts Are Added to The Backend in An Array.
• Registration Form Is Also Added in Which Temporary Account Is Created to
Login.
• Tab Control Having Items of Different Categories Beverages, Meats,
Vegetables, Fruits Each Product Has a Add to Cart Feature After Clicking on
It at the Backend the Count of The Product Will Increase.
• Each Products Has Specific Stocks Which Will Decrease the Product
Quantity of the Product at Backend.
• Each Product Has a Specific Price Which Will Increase by Clicking at Add to
Cart. Each time the button is clicked the price will increase.
• Form Has a My Cart Button Which Will Show All the Added Product with
Specific Total Prices of each product and the total bill.
• By Adding a Promo Code “Bachat15” 15% Discount Will Be Provided.
• 5% GST Will Be added to the total bill.
• DataGrid View Is Used for To Show the Items at The Cart After Each
Product’s Add to Cart Click.
• After Clicking on The Order Now Button A Form Prompting “Rider Has Been
Dispatched To Your Location” Will Appear.
App Logo:
METHODOLOGY:
Registration Class:
public class Registration
{
public string username { get; set; }
public string password { get; set; }
}
REGISTRATION-FORM:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace _2nd_Sem_Project
{
public partial class Form3 : Form
{
public Form3()
{
InitializeComponent();
}
public Registration user;
private void Form3_Load(object sender, EventArgs e)
{
Login.ShowDialog();
}
}
}
}
IN-APP DEMONSTRATION:
LOGIN-FORM:
User Has To Login To The System Before Buying And Accessing The Products
CODE:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace _2nd_Sem_Project
{
public partial class Form1 : Form
{
string NewUser, NewPassword;
public Form1()
{
InitializeComponent();
}
public Form1(Registration user)
{
InitializeComponent();
NewUser = user.username;
NewPassword = user.password;
}
//Register Now Form
}
private void Register_Click(object sender, EventArgs e)
{
this.Hide();
Form3 RegisterNow = new Form3();
RegisterNow.ShowDialog();
}
private void button1_Click_1(object sender, EventArgs e)
{
//Following are the index sensitive password and username password entered should be of same index
as username
// The NewUser And NewPassword Variable Will Have The Registration Form’s Username & Password
}
}
}
LOGIN DEMONSTRATION:
PRODUCT CLASS:
CODE:
//A Template Class for All the Products in The System
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace _2nd_Sem_Project
{
public class Product
{
public string Description { get; set; }
public double BasePrice { get; set; }
namespace _2nd_Sem_Project
{
public partial class Form2 : Form
{
//Array Of Objects For Class Product
public Product[] MyProducts = new Product[30];
public double TotalCartPrice;
public Form2()
{
InitializeComponent();
//Fruit Products
MyProducts[0] = new Product("1 Box Of Cherry", 100,10);
MyProducts[1] = new Product("1 Dozen Bananna", 80,10);
MyProducts[2] = new Product("1Kg Cheeku", 250,10);
//Vegetable Products
MyProducts[3] = new Product("Cucumber", 25,10);
MyProducts[4] = new Product("Tomato", 80,10);
MyProducts[5] = new Product("Brocolli", 40,10);
MyProducts[6] = new Product("Capsicum", 30,10);
MyProducts[7] = new Product("Egg Plant", 35,10);
MyProducts[8] = new Product("Chillis", 20,10);
//Beverages Products
MyProducts[9] = new Product("Pepsi 500ml", 60,10);
MyProducts[10] = new Product("Coca Cola 500ml", 60,10);
MyProducts[11] = new Product("Mirinda 500ml", 60,10);
MyProducts[12] = new Product("7-Up 500ml", 60,10);
MyProducts[13] = new Product("AquaFina 500ml", 35,10);
//Meat Products
MyProducts[14] = new Product("Mutton 1kg", 750,10);
MyProducts[15] = new Product("Beef 1kg", 550,10);
MyProducts[16] = new Product("Chicken 1kg",350,10);
//More Fruit Products
MyProducts[17] = new Product("1Kg Falsa", 250, 10);
MyProducts[18] = new Product("1Kg Mango", 250, 10);
//
MyProducts[19] = new Product("Juice", 30, 20);
MyProducts[20] = new Product("RoohAfza", 70, 20);
MyProducts[21] = new Product("Sting", 60, 20);
MyProducts[22] = new Product("Strawberry", 270, 20);
MyProducts[23] = new Product("1Kg Tuna Fish", 350, 20);
MyProducts[24] = new Product("1Kg Rohu Fish", 550, 20);
MyProducts[25] = new Product("1Kg Trout Fish", 450, 20);
}
//By Entering The Promo Code Sara15 Customer Will Get A 15% Discount In Final Order
{
MyProducts[6].ProductCount += 1;
MyProducts[6].TotalProductPrice = MyProducts[6].ProductCount * MyProducts[6].BasePrice;
MyProducts[6].ProductStock -= 1;
if (MyProducts[6].ProductStock==0)
{
MessageBox.Show("Sorry! The Product Is Out Of Stock Now:");
}
}
private void EggPlantBtn_Click(object sender, EventArgs e)
{
MyProducts[7].ProductCount += 1;
MyProducts[7].TotalProductPrice = MyProducts[7].ProductCount * MyProducts[7].BasePrice;
MyProducts[7].ProductStock -= 1;
if (MyProducts[7].ProductStock==0)
{
MessageBox.Show("Sorry! The Product Is Out Of Stock Now:");
}
}
private void ChilliBtn_Click(object sender, EventArgs e)
{
MyProducts[8].ProductCount += 1;
MyProducts[8].TotalProductPrice = MyProducts[8].ProductCount * MyProducts[8].BasePrice;
MyProducts[8].ProductStock -= 1;
if (MyProducts[8].ProductStock == 0)
{
MessageBox.Show("Sorry! The Product Is Out Of Stock Now:");
}
}
private void Pepsibtn_Click(object sender, EventArgs e)
{
MyProducts[9].ProductCount += 1;
MyProducts[9].TotalProductPrice = MyProducts[9].ProductCount * MyProducts[9].BasePrice;
MyProducts[9].ProductStock -= 1;
if (MyProducts[9].ProductStock==0)
{
MessageBox.Show("Sorry! The Product Is Out Of Stock Now:");
}
}
private void CokeBtn_Click(object sender, EventArgs e)
{
MyProducts[10].ProductCount += 1;
MyProducts[10].TotalProductPrice = MyProducts[10].ProductCount * MyProducts[10].BasePrice;
MyProducts[10].ProductStock -= 1;
if (MyProducts[10].ProductStock==0)
{
MessageBox.Show("Sorry! The Product Is Out Of Stock Now:");
}
}
}
private void WaterBtn_Click(object sender, EventArgs e)
{
MyProducts[13].ProductCount += 1;
MyProducts[13].TotalProductPrice = MyProducts[13].ProductCount * MyProducts[13].BasePrice;
MyProducts[13].ProductStock -= 1;
if (MyProducts[13].ProductStock==0)
{
MessageBox.Show("Sorry! The Product Is Out Of Stock Now:");
}
}
private void MuttonBtn_Click(object sender, EventArgs e)
{
MyProducts[14].ProductCount += 1;
MyProducts[14].TotalProductPrice = MyProducts[14].ProductCount * MyProducts[14].BasePrice;
MyProducts[14].ProductStock -= 1;
if (MyProducts[14].ProductStock==0)
{
MessageBox.Show("Sorry! The Product Is Out Of Stock Now:");
}
}
private void BeefBtn_Click(object sender, EventArgs e)
{
MyProducts[15].ProductCount += 1;
MyProducts[15].TotalProductPrice = MyProducts[15].ProductCount * MyProducts[15].BasePrice;
MyProducts[15].ProductStock -= 1;
if (MyProducts[15].ProductStock==0)
{
MessageBox.Show("Sorry! The Product Is Out Of Stock Now:");
}
}
private void ChickenBtn_Click(object sender, EventArgs e)
{
MyProducts[16].ProductCount += 1;
MyProducts[16].TotalProductPrice = MyProducts[16].ProductCount * MyProducts[16].BasePrice;
MyProducts[16].ProductStock -= 1;
if (MyProducts[16].ProductStock==0)
{
MessageBox.Show("Sorry! The Product Is Out Of Stock Now:");
}
//After Clicking Place Order The Order And Items Will Reset Without Reseting The Stocks
private void buttonfalsa_Click(object sender, EventArgs e)
{
MyProducts[17].ProductCount += 1;
MyProducts[17].TotalProductPrice = MyProducts[17].ProductCount *
MyProducts[17].BasePrice;
MyProducts[17].ProductStock -= 1;
if (MyProducts[17].ProductStock == 0)
{
MessageBox.Show("Sorry! The Product Is Out Of Stock Now:");
}
}
private void btnMango_Click(object sender, EventArgs e)
{
MyProducts[18].ProductCount += 1;
MyProducts[18].TotalProductPrice = MyProducts[18].ProductCount *
MyProducts[18].BasePrice;
MyProducts[18].ProductStock -= 1;
if (MyProducts[18].ProductStock == 0)
{
MessageBox.Show("Sorry! The Product Is Out Of Stock Now:");
}
}
private void Juicebtn_Click(object sender, EventArgs e)
{
MyProducts[19].ProductCount += 1;
MyProducts[19].TotalProductPrice = MyProducts[19].ProductCount * MyProducts[19].BasePrice;
MyProducts[19].ProductStock -= 1;
if (MyProducts[19].ProductStock == 0)
{
MessageBox.Show("Sorry! The Product Is Out Of Stock Now:");
}
}
dataGridView1.Rows.Clear();
for (int i = 0; i < 26; i++)
{
MyProducts[i].ProductCount = 0;
}
label24.Text = " ";
label22.Text = "GST (5%): ";
//tabControl1.SelectTab(tabPage1);
//this.Hide();
PromoLabel.Text = "Discount: ";
}
}
//When We Will Click On My Cart Tab Following Workings Takes Place
private void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
{
if (tabControl1.SelectedTab == tabPage3)
{
//DataGrid Will Reset Each Time The Tab Is Selected
dataGridView1.Rows.Clear();
TotalCartPrice = 0;
for (int i = 0; i < 26; i++)
{
if (MyProducts[i].ProductCount > 0)
{
//Loop If The Quantity Ordered Is More Than Available Stock
while (MyProducts[i].ProductStock < 0)
{
MyProducts[i].ProductCount--;
MyProducts[i].ProductStock++;
MyProducts[i].TotalProductPrice -= MyProducts[i].BasePrice;
}
if (MyProducts[i].ProductStock >= 0)
{
//New Rows Are Created For Data Grid View Coloumns For Each Added To Cart Product
string[] row = new string[] { MyProducts[i].ProductCount.ToString(),
MyProducts[i].Description, MyProducts[i].TotalProductPrice.ToString() };
dataGridView1.Rows.Add(row);
TotalCartPrice += MyProducts[i].TotalProductPrice;
}
}
}
//5 Percent GST On The Total Bill
double GST = TotalCartPrice * 0.05;
label22.Text = "GST (5%): " + GST.ToString()+" Rs. ";
TotalCartPrice += GST;
label24.Text = (TotalCartPrice.ToString()+" Rs. ");
//Add Random Order No For Every Order
Random InvoiceNo = new Random();
int orderno = InvoiceNo.Next(1,1000);
label23.Text = "Order #: " + orderno;
}
}
}
}