Bakery Shop Order Form
A Windows Forms point-of-sale style order form that totals bakery items, applies sales tax and an optional discount, then resets cleanly for the next customer.
Overview
The user selects one or more bakery items and the application calculates a subtotal from quantity and price. A sales tax rate is applied, an optional discount can be toggled on or off, and the final total is displayed for the customer.
Alongside the calculation logic, the form includes a clear/reset function so the same form can be reused for multiple customers without closing and reopening the application.
Core Logic
private void btnCalculate_Click(object sender, EventArgs e)
{
decimal subtotal = 0m;
if (chkDonut.Checked)
subtotal += DONUT_PRICE * nudDonutQuantity.Value;
if (chkCookie.Checked)
subtotal += COOKIE_PRICE * nudCookieQuantity.Value;
decimal tax = subtotal * TAX_RATE;
decimal discount = 0m;
if (chkDiscount.Checked)
discount = subtotal * DISCOUNT_RATE;
decimal total = subtotal + tax - discount;
txtSubtotal.Text = subtotal.ToString("C");
txtTax.Text = tax.ToString("C");
txtDiscount.Text = discount.ToString("C");
txtTotal.Text = total.ToString("C");
}
Simplified from the real project, which uses the specific controls built for the form — but the shape is the same: gather items, subtotal, tax, optional discount, format as currency.
- ▸Building a basic order-entry workflow in C# Windows Forms.
- ▸Handling button click events and updating the UI in response to input.
- ▸Keeping subtotal, tax, and discount math clear and maintainable.
- ▸Formatting numeric output as currency and resetting a form for the next transaction.