Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace Workshop_Calculator
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private void btnCalculate_Click(object sender, EventArgs e)
- {
- int num_days, reg_fee, lodge_fee, lodge_total, total;
- string workshop, location;
- if (lboxWorkshop.SelectedIndex == -1 || lboxLocation.SelectedIndex == -1)
- {
- MessageBox.Show("Select a Workshop and Location.");
- return;
- }
- workshop = lboxWorkshop.SelectedItem.ToString();
- switch (workshop)
- {
- case "Handling Stress":
- num_days = 3;
- reg_fee = 1000;
- break;
- default:
- num_days = 0;
- reg_fee = 0;
- break;
- }
- location = lboxLocation.SelectedItem.ToString();
- switch (location)
- {
- case "Austin":
- lodge_fee = 150;
- break;
- default:
- lodge_fee = 0;
- break;
- }
- lodge_total = (lodge_fee * num_days);
- total = (lodge_total + reg_fee);
- boxRegcost.Text = reg_fee.ToString("c");
- boxLodgecost.Text = lodge_total.ToString("c");
- boxTotal.Text = total.ToString("c");
- }
- private void btnExit_Click(object sender, EventArgs e)
- {
- this.Close();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement