Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 6

Task 3

Radio Buttons- For the burgers I used radio buttons so the user can only select
one burger. The drop down menu brings up 3 different sizes of burgers and the
price of the burger is based on the burger size e.g. 4oz buffalo burger is $8.50.

Checkboxes- I used Checkboxes for the toppings so the user can have multiple
toppings on their burger because it adds flavour to the burger and gives the
customer more of a choice. E.g. instead of just having onions, you could have
onions and ketchup. When adding topping in I used labels so I could write what
the toppings were.

Radio Buttons- I used radio buttons for the drinks because I think the user
would only like one drink. By adding checkboxes it would just be a mess if I
added up all the drinks or the ones the user selected.

Textboxs- For the credit card details I used text boxes but resized them for the
16 digit number. Text boxes are good because the user and type a number in
them. I done the same for the 3 digit CVC.

Code

private void rdoBuffalo_Click(object sender, EventArgs e)


{
cmbSizePrice.Items.Clear();
cmbSizePrice.Text = "";
if (rdoBuffalo.Checked)
{
cmbSizePrice.Items.Add("2oz $6.50");
cmbSizePrice.Items.Add("4oz $8.50");
cmbSizePrice.Items.Add("8oz $10.00");
cmbSizePrice.Text = "2oz $6.50";
}
}// end rdoBuffalo_Click
private void rdoTexas_Click(object sender, EventArgs e)
{
cmbSizePrice.Items.Clear();
cmbSizePrice.Text = "";
if (rdoTexas.Checked)
{
cmbSizePrice.Items.Add("2oz $7.20");
cmbSizePrice.Items.Add("4oz $8.30");
cmbSizePrice.Items.Add("8oz $9.70");
cmbSizePrice.Text = "2oz $7.20";
}
}// end rdoTexas_Click

private void rdoRoyale_Click(object sender, EventArgs e)


{
cmbSizePrice.Items.Clear();
cmbSizePrice.Text = "";
if (rdoRoyale.Checked)
{
cmbSizePrice.Items.Add("2oz $7.50");
cmbSizePrice.Items.Add("4oz $8.60");
cmbSizePrice.Items.Add("8oz $10.50");
}

cmbSizePrice.Text = "2oz $7.50";

}// end rdoRoyale_Click

I used this code because every time I want to add an item it will add it to the
receipt which makes a lot of easier. This piece of code is used when you want to
add item.

2. Loop
private void frmLogin_Load(object sender, EventArgs e)
{
staffArray[0] = "Ann";
staffArray[1] = "Tom";
staffArray[2] = "Sam";
staffArray[3] = "Doug";
txtPassword.Focus();
}

For the login the staff array can contain a list of names. The names that
have been put into the staff array is what is the password for the login. So
whenever you type in a name the staff array will loop around to it finds a
match. If it does not find a match then it will say login unsuccessful and
close down.

3. Variables
private void btnPlaceOrder_Click(object sender, EventArgs e)
{
double mealTotal = 0;
double toppingsCost = 0;
double burgerCost = 0;
double drinkCost = 0;

A variable is a symbolic name associated with a value. I used this for the meal
total, topping cost, burger cost and the drink cost.

4. Procedures
private void rdoBuffalo_Click(object sender, EventArgs e)
{

A procedure is when the program tells the piece of code to do something.

5. Event Triggers
Example
Click
private void rdoTexas_Click(object sender, EventArgs e)
{

Timer
private void timer1_Tick_1(object sender, EventArgs e)
{

Key Press
private void txtNum2_KeyPress(object sender, KeyPressEventArgs e)
{

Event triggers are used to represent when something happens e.g.


whenever you click on a button such as placing an order an event will
happen when it adds the price to the receipt.

You might also like