Advertisement
Guest User

Untitled

a guest
Oct 30th, 2014
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.84 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10.  
  11. namespace Workshop_Calculator
  12. {
  13. public partial class Form1 : Form
  14. {
  15. public Form1()
  16. {
  17. InitializeComponent();
  18. }
  19.  
  20. private void btnCalculate_Click(object sender, EventArgs e)
  21. {
  22. int num_days, reg_fee, lodge_fee, lodge_total, total;
  23. string workshop, location;
  24.  
  25. if (lboxWorkshop.SelectedIndex == -1 || lboxLocation.SelectedIndex == -1)
  26. {
  27. MessageBox.Show("Select a Workshop and Location.");
  28. return;
  29. }
  30. workshop = lboxWorkshop.SelectedItem.ToString();
  31. switch (workshop)
  32. {
  33. case "Handling Stress":
  34. num_days = 3;
  35. reg_fee = 1000;
  36. break;
  37. default:
  38. num_days = 0;
  39. reg_fee = 0;
  40. break;
  41. }
  42. location = lboxLocation.SelectedItem.ToString();
  43. switch (location)
  44. {
  45. case "Austin":
  46. lodge_fee = 150;
  47. break;
  48. default:
  49. lodge_fee = 0;
  50. break;
  51. }
  52. lodge_total = (lodge_fee * num_days);
  53. total = (lodge_total + reg_fee);
  54. boxRegcost.Text = reg_fee.ToString("c");
  55. boxLodgecost.Text = lodge_total.ToString("c");
  56. boxTotal.Text = total.ToString("c");
  57. }
  58.  
  59. private void btnExit_Click(object sender, EventArgs e)
  60. {
  61. this.Close();
  62. }
  63. }
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement