Advertisement
Guest User

Untitled

a guest
Dec 21st, 2014
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 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 Mileage_Reimbursement
  12. {
  13. public partial class Form1 : Form
  14. {
  15. int startingMileage;
  16. int endingMileage;
  17. double milesTraveled;
  18. double reimburseRate = .39;
  19. double amountOwed;
  20. public Form1()
  21. {
  22. InitializeComponent();
  23. }
  24. private void button1_Click(object sender, EventArgs e)
  25. {
  26. startingMileage = (int)numericUpDown1.Value;
  27. endingMileage = (int)numericUpDown2.Value;
  28. if (startingMileage <= endingMileage)
  29. {
  30. milesTraveled = endingMileage -= startingMileage;
  31. amountOwed = milesTraveled *= reimburseRate;
  32. label4.Text = "$" + amountOwed;
  33. }
  34. else
  35. {
  36. MessageBox.Show("The starting mileage must be less than the ending mileage.",
  37. "Cannot Calculate Mileage");
  38. }
  39. }
  40. }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement