C4V – Introduction to C# Programming Assignment #3 For this assignment, you will individually complete the programming problems in this document. Be sure to read this entire document prior to...

1 answer below »
Hi, looking to see how much and the yellow highlighted part of the instructions is very important to the final grade.


C4V – Introduction to C# Programming Assignment #3 For this assignment, you will individually complete the programming problems in this document. Be sure to read this entire document prior to beginning your work. Ensure that you follow the instructions carefully and you complete the assignment yourself. Sharing and receiving of assignment files or solutions between students is strictly prohibited and will be referred to the Associate Dean’s office via an Academic Alert. General Instructions Evaluation of the assignment will be based on:  Whether the requirements stated in the problems are satisfied.  Whether naming and capitalization conventions are followed, including using descriptive names for variables, parameters, classes, interfaces, members, etc. (Code generated by Visual Studio is exempted.) Please see the instructions at the end of this document on what files to submit for this assignment. Problem (20 marks) Write a program that simulates a simplified pizza ordering system. Change the text of the Form control to the name of your fictitious pizzeria. (1 mark) Provide three choices for the size of the pizza: (2 marks)  Place three (3) RadioButton controls within a GroupBox control.  Use “Small ($7.00)”, “Medium ($9.00)”, and “Large ($11.00)” as text for the RadioButtons. (Feel free to use actual prices in your area.) https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/members  Change the font size used for the RadioButton’s text such that the word “Medium” is larger than “Small” and “Large” is larger than “Medium” (see screen capture).  The user may select only one size. Provide five choices for the toppings: (2 marks)  Place five (5) CheckBox controls within a GroupBox control.  You may use your top five favourite toppings.  All toppings have the same price based on the size of the pizza. For example, each topping costs $1 for a small pizza, $1.50 for a medium pizza, and $2 for a large pizza. Again, feel free to use actual prices in your area. This unit price must be displayed within the GroupBox control.  The user may select up to five toppings or no topping at all (cheese pizza!). Provide an area for the user to enter their contact information: (2 marks)  Place three (3) Label controls and three (3) TextBox controls in a GroupBox control.  Use “Delivery Address”, “Name”, and “Phone Number” as text for the Label controls.  The maximum number of characters in the TextBox control for the phone number is 12. Provide an area for the user to enter the payment information: (2 marks)  Place two (2) Label controls and two (2) TextBox controls in a GroupBox control.  Use “Credit Card Number” and “Expiry (MM/YY)” as text for the Label controls.  The maximum number of characters in the TextBox control for the credit card number is 16.  The maximum number of characters in the TextBox control for the expiry is 5. Display the total amount: (1 mark)  The total amount must be updated when a different size pizza is selected.  The total amount must be updated when toppings are changed.  For this assignment, let’s not worry about any taxes. ? Provide a button for the user to place the order: (8 marks)  When the user clicks the button, all user inputs (in TextBox controls) must be validated. o The delivery address and the name must not be blank or just white spaces. o The phone number must have the format xxx-xxx-xxxx, where x is a digit. o The credit card number must consist of 16 digits. o The expiry must have the format MM/YY, where MM represents the month (01, 02, …, 11, 12) and YY represents the last two digits of the year. (In this assignment, you do not have to flag an error if the credit card has expired.)  Display an error message using MessageBox for each invalid user input (see example below).  Choose a background colour other than white for the button.  If all user inputs are valid, display a message indicating that the order has been placed (see example below).  If all user inputs are valid, reset the order form for a new order. o Select a small size pizza. o Clear all topping CheckBox controls. o Clear all TextBox controls. Instructions for Submission Multiple files make up a Windows Forms project, in addition to C# source files. Please see the screen capture below for an example of files that you might see on your own computer. (You'll probably have two additional sub-folders inside your project folder named bin and obj. That's okay.) One easy way to ensure you submit the correct files is to create a compressed folder of the project folder and upload the resulting .zip file:  In Windows Explorer, locate the project folder.  Right-click the project folder, left-click Send to, left-click Compressed (zipped) folder.  A .zip file with the same name as the project folder will be created.  Open the .zip file to ensure that it contains the correct files.  Upload the .zip file before the assignment due date.
Answered Same DayOct 02, 2021

Answer To: C4V – Introduction to C# Programming Assignment #3 For this assignment, you will individually...

Aditya answered on Oct 07 2021
142 Votes
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/PizzaDelie
very/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 =...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here