Question

Create an order entry screen program in C# to give a total for an individual pizza...

Create an order entry screen program in C# to give a total for an individual pizza order. The Pizza order should have radio buttons for small $7, medium $9, and large $12 choices for the pizza. There should be a checkbox for drink (where a drink is $2 added if it is checked and nothing added if it is not checked. Include a textbox for the customer’s name. Have a button to calculate the subtotal (pizza choice and whether there is a drink or not on the order), tax (.07 of the subtotal) and the total (subtotal plus tax). Put these calculated values into labels on the screen for the user. Also have another label show a message to show the customer’s pizza is ready with their name from the textbox. Include a button to clear the order, it should clear the textbox, set the radio buttons back to having the large one selected, the checkbox for the drink should be unchecked, and textbox and the message label should be cleared. Make sure to rename the buttons and the output labels, they should not be named “button1”, “label1”, they should have descriptive names as will be discussed in class

Add 3 comboboxes for toppings choices or one Checked Listbox (it is up to you but the business rule is the customer can have up to 3 additional toppings) for this. Include 5 or so reasonable choices for the toppings to be shown. For each one the user selects $1.5 should be added to the subtotal when the order is calculated. Example: The user selects a medium pizza, no drink, and pulls down and selects “Pepperoni” and “Extra Cheese” and doesn’t select a third extra topping. Their subtotal should be $12. Make the Calculate button to be the ‘Accept’ button so the order is calculated if the user presses Enter. Make the Clear button the ‘Cancel’ button so the order is cleared when the user presses the Esc key.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

In case of any issue, do comment. Please rate answer as well.

Code:

==========PizzaOrderEntry.cs=========

using System;
using System.Globalization;
using System.Windows.Forms;

namespace PizzaOrder
{
public partial class PizzaOrderEntry : Form
{
public PizzaOrderEntry()
{
InitializeComponent();
}

/// <summary>
/// handles the Form Load event
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void PizzaOrderEntry_Load(object sender, EventArgs e)
{
SetInitialState();
}

/// <summary>
/// handles the click event of calculate button
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnCalculate_Click(object sender, EventArgs e)
{
double subTotal = 0.0, tax =0.0;
//if rdSmallPizza is checked then add the price of 7
if (rdSmallPizza.Checked)
{
subTotal = 7.00;
}
else if(rdMediumPizza.Checked) //if medium is checked then add the price of 9
{
subTotal = 9.00;
}
else
{
subTotal = 12.00; //else add the price of 12
}

//check if Drink check box is checked then add $2
if (chkDrink.Checked)
{
subTotal += 2;
}
//Verify the toppings added and accordinly add $1.5 to subtotal if topping is selected
if (cmbFirstTopping.SelectedIndex != -1)
{
subTotal += 1.5;
}
  
if (cmbSecondTopping.SelectedIndex != -1)
{
subTotal += 1.5;
}


if (cmbThirdTopping.SelectedIndex != -1)
{
subTotal += 1.5;
}
//calculate and display output
tax = subTotal * 0.07;
lblSubTotal.Text = string.Format(new CultureInfo("en-us"), "SubTotal : {0:C}",subTotal);
lblTax.Text = string.Format(new CultureInfo("en-us"), "Tax : {0:C}", tax);
lblTotal.Text = string.Format(new CultureInfo("en-us"), "Total : {0:C}", subTotal + tax);

lblOutput.Text = "Pizza is ready for Customer: " + txtCustomer.Text;
}

private void btnClear_Click(object sender, EventArgs e)
{
SetInitialState();
}

/// <summary>
/// set the intial state of the form
/// </summary>
private void SetInitialState()
{
txtCustomer.Clear();
rdLargePizza.Checked = true;
chkDrink.Checked = false;
lblOutput.Text = string.Empty;
lblSubTotal.Text = string.Empty;
lblTax.Text = string.Empty;
lblTotal.Text = string.Empty;
cmbFirstTopping.SelectedIndex = -1;
cmbSecondTopping.SelectedIndex = -1;
cmbThirdTopping.SelectedIndex = -1;
}
}
}

===============PizzzaOrderEntry.Designer.cs========

namespace PizzaOrder
{
partial class PizzaOrderEntry
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;

/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}

#region Windows Form Designer generated code

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.lblMain = new System.Windows.Forms.Label();
this.rdSmallPizza = new System.Windows.Forms.RadioButton();
this.rdMediumPizza = new System.Windows.Forms.RadioButton();
this.rdLargePizza = new System.Windows.Forms.RadioButton();
this.chkDrink = new System.Windows.Forms.CheckBox();
this.btnCalculate = new System.Windows.Forms.Button();
this.btnClear = new System.Windows.Forms.Button();
this.lblSubTotal = new System.Windows.Forms.Label();
this.lblTax = new System.Windows.Forms.Label();
this.lblTotal = new System.Windows.Forms.Label();
this.lblCustomer = new System.Windows.Forms.Label();
this.txtCustomer = new System.Windows.Forms.TextBox();
this.cmbFirstTopping = new System.Windows.Forms.ComboBox();
this.cmbSecondTopping = new System.Windows.Forms.ComboBox();
this.cmbThirdTopping = new System.Windows.Forms.ComboBox();
this.lblOutput = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// lblMain
//
this.lblMain.AutoSize = true;
this.lblMain.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblMain.Location = new System.Drawing.Point(224, 39);
this.lblMain.Name = "lblMain";
this.lblMain.Size = new System.Drawing.Size(149, 20);
this.lblMain.TabIndex = 0;
this.lblMain.Text = "Pizza Order Entry";
//
// rdSmallPizza
//
this.rdSmallPizza.AutoSize = true;
this.rdSmallPizza.Location = new System.Drawing.Point(60, 98);
this.rdSmallPizza.Name = "rdSmallPizza";
this.rdSmallPizza.Size = new System.Drawing.Size(65, 17);
this.rdSmallPizza.TabIndex = 1;
this.rdSmallPizza.TabStop = true;
this.rdSmallPizza.Tag = "7";
this.rdSmallPizza.Text = "Small $7";
this.rdSmallPizza.UseVisualStyleBackColor = true;
//
// rdMediumPizza
//
this.rdMediumPizza.AutoSize = true;
this.rdMediumPizza.Location = new System.Drawing.Point(170, 98);
this.rdMediumPizza.Name = "rdMediumPizza";
this.rdMediumPizza.Size = new System.Drawing.Size(77, 17);
this.rdMediumPizza.TabIndex = 2;
this.rdMediumPizza.TabStop = true;
this.rdMediumPizza.Tag = "9";
this.rdMediumPizza.Text = "Medium $9";
this.rdMediumPizza.UseVisualStyleBackColor = true;
//
// rdLargePizza
//
this.rdLargePizza.AutoSize = true;
this.rdLargePizza.Location = new System.Drawing.Point(272, 98);
this.rdLargePizza.Name = "rdLargePizza";
this.rdLargePizza.Size = new System.Drawing.Size(73, 17);
this.rdLargePizza.TabIndex = 3;
this.rdLargePizza.TabStop = true;
this.rdLargePizza.Tag = "12";
this.rdLargePizza.Text = "Large $12";
this.rdLargePizza.UseVisualStyleBackColor = true;
//
// chkDrink
//
this.chkDrink.AutoSize = true;
this.chkDrink.Location = new System.Drawing.Point(60, 139);
this.chkDrink.Name = "chkDrink";
this.chkDrink.Size = new System.Drawing.Size(129, 17);
this.chkDrink.TabIndex = 4;
this.chkDrink.Text = "Want to include Drink";
this.chkDrink.UseVisualStyleBackColor = true;
//
// btnCalculate
//
this.btnCalculate.Location = new System.Drawing.Point(60, 378);
this.btnCalculate.Name = "btnCalculate";
this.btnCalculate.Size = new System.Drawing.Size(148, 39);
this.btnCalculate.TabIndex = 5;
this.btnCalculate.Text = "Calculate";
this.btnCalculate.UseVisualStyleBackColor = true;
this.btnCalculate.Click += new System.EventHandler(this.btnCalculate_Click);
//
// btnClear
//
this.btnClear.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnClear.Location = new System.Drawing.Point(300, 378);
this.btnClear.Name = "btnClear";
this.btnClear.Size = new System.Drawing.Size(140, 39);
this.btnClear.TabIndex = 6;
this.btnClear.Text = "Clear";
this.btnClear.UseVisualStyleBackColor = true;
this.btnClear.Click += new System.EventHandler(this.btnClear_Click);
//
// lblSubTotal
//
this.lblSubTotal.AutoSize = true;
this.lblSubTotal.Location = new System.Drawing.Point(81, 285);
this.lblSubTotal.Name = "lblSubTotal";
this.lblSubTotal.Size = new System.Drawing.Size(0, 13);
this.lblSubTotal.TabIndex = 7;
//
// lblTax
//
this.lblTax.AutoSize = true;
this.lblTax.Location = new System.Drawing.Point(104, 313);
this.lblTax.Name = "lblTax";
this.lblTax.Size = new System.Drawing.Size(0, 13);
this.lblTax.TabIndex = 8;
//
// lblTotal
//
this.lblTotal.AutoSize = true;
this.lblTotal.Location = new System.Drawing.Point(98, 339);
this.lblTotal.Name = "lblTotal";
this.lblTotal.Size = new System.Drawing.Size(0, 13);
this.lblTotal.TabIndex = 9;
//
// lblCustomer
//
this.lblCustomer.AutoSize = true;
this.lblCustomer.Location = new System.Drawing.Point(57, 196);
this.lblCustomer.Name = "lblCustomer";
this.lblCustomer.Size = new System.Drawing.Size(88, 13);
this.lblCustomer.TabIndex = 10;
this.lblCustomer.Text = "Customer Name: ";
//
// txtCustomer
//
this.txtCustomer.Location = new System.Drawing.Point(151, 196);
this.txtCustomer.Name = "txtCustomer";
this.txtCustomer.Size = new System.Drawing.Size(120, 20);
this.txtCustomer.TabIndex = 11;
//
// cmbFirstTopping
//
this.cmbFirstTopping.FormattingEnabled = true;
this.cmbFirstTopping.Items.AddRange(new object[] {
"Pepperoni",
"Extra Cheese",
"Mushrooms",
"Black olives",
"Sausage"});
this.cmbFirstTopping.Location = new System.Drawing.Point(60, 243);
this.cmbFirstTopping.Name = "cmbFirstTopping";
this.cmbFirstTopping.Size = new System.Drawing.Size(122, 21);
this.cmbFirstTopping.TabIndex = 12;
//
// cmbSecondTopping
//
this.cmbSecondTopping.FormattingEnabled = true;
this.cmbSecondTopping.Items.AddRange(new object[] {
"Pepperoni",
"Extra Cheese",
"Mushrooms",
"Black olives",
"Sausage"});
this.cmbSecondTopping.Location = new System.Drawing.Point(240, 243);
this.cmbSecondTopping.Name = "cmbSecondTopping";
this.cmbSecondTopping.Size = new System.Drawing.Size(122, 21);
this.cmbSecondTopping.TabIndex = 13;
//
// cmbThirdTopping
//
this.cmbThirdTopping.FormattingEnabled = true;
this.cmbThirdTopping.Items.AddRange(new object[] {
"Pepperoni",
"Extra Cheese",
"Mushrooms",
"Black olives",
"Sausage"});
this.cmbThirdTopping.Location = new System.Drawing.Point(403, 243);
this.cmbThirdTopping.Name = "cmbThirdTopping";
this.cmbThirdTopping.Size = new System.Drawing.Size(122, 21);
this.cmbThirdTopping.TabIndex = 14;
//
// lblOutput
//
this.lblOutput.AutoSize = true;
this.lblOutput.Location = new System.Drawing.Point(57, 447);
this.lblOutput.Name = "lblOutput";
this.lblOutput.Size = new System.Drawing.Size(0, 13);
this.lblOutput.TabIndex = 15;
//
// PizzaOrderEntry
//
this.AcceptButton = this.btnCalculate;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.btnClear;
this.ClientSize = new System.Drawing.Size(800, 522);
this.Controls.Add(this.lblOutput);
this.Controls.Add(this.cmbThirdTopping);
this.Controls.Add(this.cmbSecondTopping);
this.Controls.Add(this.cmbFirstTopping);
this.Controls.Add(this.txtCustomer);
this.Controls.Add(this.lblCustomer);
this.Controls.Add(this.lblTotal);
this.Controls.Add(this.lblTax);
this.Controls.Add(this.lblSubTotal);
this.Controls.Add(this.btnClear);
this.Controls.Add(this.btnCalculate);
this.Controls.Add(this.chkDrink);
this.Controls.Add(this.rdLargePizza);
this.Controls.Add(this.rdMediumPizza);
this.Controls.Add(this.rdSmallPizza);
this.Controls.Add(this.lblMain);
this.Name = "PizzaOrderEntry";
this.Text = "Pizza Order Entry";
this.Load += new System.EventHandler(this.PizzaOrderEntry_Load);
this.ResumeLayout(false);
this.PerformLayout();

}

#endregion

private System.Windows.Forms.Label lblMain;
private System.Windows.Forms.RadioButton rdSmallPizza;
private System.Windows.Forms.RadioButton rdMediumPizza;
private System.Windows.Forms.RadioButton rdLargePizza;
private System.Windows.Forms.CheckBox chkDrink;
private System.Windows.Forms.Button btnCalculate;
private System.Windows.Forms.Button btnClear;
private System.Windows.Forms.Label lblSubTotal;
private System.Windows.Forms.Label lblTax;
private System.Windows.Forms.Label lblTotal;
private System.Windows.Forms.Label lblCustomer;
private System.Windows.Forms.TextBox txtCustomer;
private System.Windows.Forms.ComboBox cmbFirstTopping;
private System.Windows.Forms.ComboBox cmbSecondTopping;
private System.Windows.Forms.ComboBox cmbThirdTopping;
private System.Windows.Forms.Label lblOutput;
}
}

==============screen shot of the code========

Output:

Add a comment
Know the answer?
Add Answer to:
Create an order entry screen program in C# to give a total for an individual pizza...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Please create the following pizza order form. My form images are not needed but I can...

    Please create the following pizza order form. My form images are not needed but I can supply them for you. Please be creative with your form. Pizza Order FormCalculate Order Total Clear Order When the Calculate Order Total button has been clicked, do the following: Verify that the Customer Name and Phone Number are not blank. Display an appropriate message if either textbox is empty and place the cursor in the appropriate textbox. Verify that at least one Pizza Choice...

  • Create a user friendly interface to order a pizza. Use appropriate controls (radio buttons, list boxes,...

    Create a user friendly interface to order a pizza. Use appropriate controls (radio buttons, list boxes, check boxes) to obtain the type of pizza (e.g. small, medium, large) and the toppings. Calculate the cost of the pizza based upon the size, number of toppings and delivery charge. Display a summary of the order in a text area along with the total cost. Provide buttons which places the order and clears the order. Allow for multiple pizzas to orders Submit as...

  • Project 2 Description Create a Visual C# project that when an employee's biweekly sales amount is...

    Project 2 Description Create a Visual C# project that when an employee's biweekly sales amount is entered and the Calculate button is pressed, the gross pay, deductions, and net pay will be displayed. Each employee will receive a base pay of $1200 plus a sales commission of 8% of sales. Once the net pay has been calculated, display the budget amount for each category listed below based on the percentages given.         base pay = $1200; use a named...

  • Hello, please help me to answer my assignment, i highly appreciate your effort, kindly explain it...

    Hello, please help me to answer my assignment, i highly appreciate your effort, kindly explain it clearly. Kindly put your codes in (NOTEPAD). Thank you very much. Write a VB application that will facilitate a pizza order. 1.The user interface should have a form containing all components pertaining to pizza order presented in either option buttons or check boxes. 2.Controls must also be grouped in frames according to size, toppings, or crust type. 3.The summary of order must be presented...

  • COP2860 - Introduction to C# Programming Module #5 Assignment 10 points Program Functionality: Create a C#.NET...

    COP2860 - Introduction to C# Programming Module #5 Assignment 10 points Program Functionality: Create a C#.NET program that calculates customer bills for a food truck: Assignment Requirements: Build a custom order pad for a burger truck. It should look roughly like the following: Customer Bill - OX Bob's Burgers cheese fried egg bacon avocado O rare medium well done O yes no payment? O cash credit total clear Customer Bill - 0x Bob's Burgers cheese fried egg bacon avocado Add...

  • C# Temp. Converter program. Create a Celsius and Fahrenheit Temperature Converter application. The application must have...

    C# Temp. Converter program. Create a Celsius and Fahrenheit Temperature Converter application. The application must have 2 Labels (each one of them assigned only to Celsius and Fahrenheit), 2 TextBoxes (each one of them assigned only to Celsius and Fahrenheit), only 1 Convert Button, 1 Clear Button, and 1 Exit Button. Also, 1 Error message label which will display the error messages. The application should only allow the user to enter the desired temperature just in one of the TextBoxes...

  • Project overview: Create a java graphics program that displays an order menu and bill from a...

    Project overview: Create a java graphics program that displays an order menu and bill from a Sandwich shop, or any other establishment you prefer. In this program the design is left up to the programmer however good object oriented design is required. Below are two images that should be used to assist in development of your program. Items are selected on the Order Calculator and the Message window that displays the Subtotal, Tax and Total is displayed when the Calculate...

  • Can you solve this proble by using C# application? C# is one of programming languages supported...

    Can you solve this proble by using C# application? C# is one of programming languages supported by Visual Studio 2015. It combines the features of Java and C ++ and is suitbale for rapid application development. A retail company must file a monthly sales tax report listing the total sales for the month, and the amount of state and county sales tax collected. The state sales tax rate is 4% and the county sales tax rate is 2%. Create an...

  • I NEED SOME HELP WITH THIS PLEASE :) 1. Create a data entry form on one...

    I NEED SOME HELP WITH THIS PLEASE :) 1. Create a data entry form on one of your web pages for visitors who want to be added to your mailing list. Include one of each of the following input elements*: Text <input type="text".... • Tel <input type="tel".... . Email <input type="email"... Date <input type="date"... . A set of radio buttons <input type="radio"... • A set of check boxes <input type="checkbox"... • A select element with options <select>.....</select> (do NOT add...

  • I need help writting a Javascript function that does the following its for a HTML/CSS Shopping...

    I need help writting a Javascript function that does the following its for a HTML/CSS Shopping Cart Page CODE This page contains a list of the selected products that includes an image, name, price, quantity, and cost) Because the process is implemented not as real, three products along with its image and price are displayed on the page. The product ID of each product is stored in a hidden textbox. The default amount of each product is 1 and the...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT