PizzaDelievery/.vs/PizzaDelievery/v16/.suo
PizzaDelievery/PizzaDelievery.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}") = "PizzaDelievery", "PizzaDelievery\PizzaDelievery.csproj", "{40B03273-5E85-491D-A7C0-0357BC161564}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{40B03273-5E85-491D-A7C0-0357BC161564}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{40B03273-5E85-491D-A7C0-0357BC161564}.Debug|Any CPU.Build.0 = Debug|Any CPU
{40B03273-5E85-491D-A7C0-0357BC161564}.Release|Any CPU.ActiveCfg = Release|Any CPU
{40B03273-5E85-491D-A7C0-0357BC161564}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {FD54AF79-A6C1-4C41-BD23-74DFB51E78DB}
EndGlobalSection
EndGlobal
PizzaDelievery/PizzaDelievery/App.config
PizzaDelievery/PizzaDelievery/bin/Debug/PizzaDelievery.exe
PizzaDelievery/PizzaDelievery/bin/Debug/PizzaDelievery.exe.config
PizzaDelievery/PizzaDelievery/bin/Debug/PizzaDelievery.pdb
PizzaDelievery/PizzaDelievery/Form1.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace PizzaDelievery
{
public partial class Form1 : Form
{
double totalAmount = 0.00;
double extraAmount = 0.00;
double pizzaAmount = 0.00;
double toppingAmount = 0.00;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
bool valid = true;
bool addressWhitespace = dAddress.Text.Length > 0 && dAddress.Text.Trim().Length == 0;
if (dAddress.Text == "" || addressWhitespace)
{
valid = false;
MessageBox.Show("Please Enter Address");
}
bool hasAllWhitespace = name.Text.Length > 0 && name.Text.Trim().Length == 0;
if (name.Text == "" || hasAllWhitespace)
{
valid = false;
MessageBox.Show("Please Enter Name");
}
bool cardWhitespace = Card.Text.Length > 0 && Card.Text.Trim().Length == 0;
if (Card.Text == "" || cardWhitespace || Card.Text.Length != 16 || !Regex.IsMatch(Card.Text, "^[0-9]+$"))
{
valid = false;
MessageBox.Show("Please Enter Valid Credit Card Number");
}
if (!Regex.IsMatch(Phone.Text, "\\d{3}-\\d{3}-\\d{4}"))
{
valid = false;
MessageBox.Show("Please Enter Valid Phone Number");
}
if (!Regex.IsMatch(date.Text, "\\d{2}/\\d{2}") || (date.Text.Length != 5) )
{
valid = false;
MessageBox.Show("Please Enter Valid Month and Year");
}
if (valid)
{
string text = "Thank you, "+name.Text+"! \nYour order has been placed.";
MessageBox.Show(text);
name.Text = "";
dAddress.Text = "";
date.Text = "";
Phone.Text = "";
Card.Text = "";
radioButton1.Checked = true;
checkBox1.Checked = false;
checkBox2.Checked = false;
checkBox3.Checked = false;
checkBox4.Checked = false;
checkBox5.Checked = false;
totalAmount = 0.00;
toppingAmount = 0.00;
extraAmount = 0.00;
}
}
private void radioButton1_CheckedChanged(object sender, EventArgs e)
{
pizzaAmount = 7.00;
totalAmount = pizzaAmount + toppingAmount ;
total.Text = "Total: $" + totalAmount.ToString();
}
private void radioButton2_CheckedChanged(object sender, EventArgs e)
{
pizzaAmount = 9.00;
extraAmount = 0.50;
totalAmount = pizzaAmount + toppingAmount;
total.Text = "Total: $" + totalAmount.ToString();
}
private void radioButton3_CheckedChanged(object sender, EventArgs e)
{
pizzaAmount = 11.00;
extraAmount = 1.00;
totalAmount = pizzaAmount + toppingAmount;
total.Text = "Total: $" + totalAmount.ToString();
}
private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
if (checkBox1.Checked)
{
toppingAmount = 1.00 + extraAmount + toppingAmount;
totalAmount = pizzaAmount + toppingAmount;
total.Text = "Total: $" + totalAmount.ToString();
}
else
{
toppingAmount = toppingAmount - 1.00 - extraAmount;
totalAmount = pizzaAmount + toppingAmount;
total.Text = "Total: $" + totalAmount.ToString();
}
}
private void checkBox2_CheckedChanged(object sender, EventArgs e)
{
if (checkBox2.Checked)
{
toppingAmount = 1.00 + extraAmount + toppingAmount;
totalAmount = pizzaAmount + toppingAmount;
total.Text = "Total: $" + totalAmount.ToString();
}
else
{
toppingAmount = toppingAmount - 1.00 - extraAmount;
totalAmount = pizzaAmount + toppingAmount;
total.Text = "Total: $" + totalAmount.ToString();
}
}
private void checkBox3_CheckedChanged(object sender, EventArgs e)
{
if (checkBox3.Checked)
{
toppingAmount = 1.00 + extraAmount + toppingAmount;
totalAmount = pizzaAmount + toppingAmount;
total.Text = "Total: $" + totalAmount.ToString();
}
else
{
toppingAmount = toppingAmount - 1.00 - extraAmount;
totalAmount = pizzaAmount + toppingAmount;
total.Text = "Total: $" + totalAmount.ToString();
}
}
private void checkBox4_CheckedChanged(object sender, EventArgs e)
{
if (checkBox4.Checked)
{
toppingAmount = 1.00 + extraAmount + toppingAmount;
totalAmount = pizzaAmount + toppingAmount;
total.Text = "Total: $" + totalAmount.ToString();
}
else
{
toppingAmount = toppingAmount - 1.00 - extraAmount;
totalAmount = pizzaAmount + toppingAmount;
total.Text = "Total: $" + totalAmount.ToString();
}
}
private void checkBox5_CheckedChanged(object sender, EventArgs e)
{
if (checkBox5.Checked)
{
toppingAmount = 1.00 + extraAmount + toppingAmount;
totalAmount = pizzaAmount + toppingAmount;
total.Text = "Total: $" + totalAmount.ToString();
}
else
{
toppingAmount = toppingAmount - 1.00 - extraAmount;
totalAmount = pizzaAmount + toppingAmount;
total.Text = "Total: $" + totalAmount.ToString();
}
}
}
}
PizzaDelievery/PizzaDelievery/Form1.Designer.cs
namespace PizzaDelievery
{
partial class Form1
{
///
/// Required designer variable.
/// private System.ComponentModel.IContainer components = null;
///
/// Clean up any resources being used.
/// ///
true if managed resources should be disposed; otherwise, false.
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// private void InitializeComponent()
{
this.backgroundWorker1 = new System.ComponentModel.BackgroundWorker();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.radioButton3 = new System.Windows.Forms.RadioButton();
this.radioButton2 = new System.Windows.Forms.RadioButton();
this.radioButton1 = new System.Windows.Forms.RadioButton();
this.label1 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.checkBox1 = new System.Windows.Forms.CheckBox();
this.checkBox2 = new System.Windows.Forms.CheckBox();
this.checkBox3 = new System.Windows.Forms.CheckBox();
this.checkBox4 = new System.Windows.Forms.CheckBox();
this.label6 = new System.Windows.Forms.Label();
this.Toppings = new System.Windows.Forms.GroupBox();
this.checkBox5 = new System.Windows.Forms.CheckBox();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.address = new System.Windows.Forms.Label();
this.dAddress = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.Phone = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.Card = new System.Windows.Forms.TextBox();
this.label7 = new System.Windows.Forms.Label();
this.date = new System.Windows.Forms.TextBox();
this.total = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button();
this.name = new System.Windows.Forms.TextBox();
this.groupBox1.SuspendLayout();
this.Toppings.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox3.SuspendLayout();
this.SuspendLayout();
//
// groupBox1
//
this.groupBox1.Controls.Add(this.radioButton3);
this.groupBox1.Controls.Add(this.radioButton2);
this.groupBox1.Controls.Add(this.radioButton1);
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.groupBox1.Location = new System.Drawing.Point(12, 23);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(258, 196);
this.groupBox1.TabIndex = 0;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "SIze";
//
// radioButton3
//
this.radioButton3.AutoSize = true;
this.radioButton3.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.radioButton3.Location = new System.Drawing.Point(21, 136);
this.radioButton3.Name =...