Advertisement
Kenkaster001

ACUñA

Aug 22nd, 2019
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.46 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 HOA4
  12. {
  13. public partial class Form1 : Form
  14. {
  15. public Form1()
  16. {
  17. InitializeComponent();
  18. }
  19.  
  20. private void Form1_Load(object sender, EventArgs e)
  21. {
  22.  
  23. }
  24.  
  25. private void TextBox1_TextChanged(object sender, EventArgs e)
  26. {
  27.  
  28. }
  29.  
  30. private void Button1_Click(object sender, EventArgs e)
  31. {
  32.  
  33. double weight, height, bmi;
  34. if (textBox1.Text == ("") || textBox4.Text == (""))
  35. {
  36. string title = "BMI Calculator";
  37. MessageBox.Show("Error: Don't leave anything blank!", title);
  38. }
  39. else
  40. {
  41. weight = int.Parse(textBox1.Text);
  42. height = int.Parse(textBox4.Text);
  43.  
  44. bmi = (weight * 0.45) / ((height * 0.025) * (height * 0.025));
  45. label8.Text = ("BMI: " + bmi);
  46. }
  47.  
  48. }
  49.  
  50. private void Label8_Click(object sender, EventArgs e)
  51. {
  52.  
  53.  
  54. }
  55.  
  56. private void Button2_Click(object sender, EventArgs e)
  57. {
  58.  
  59. double start, end, sum;
  60. if (textBox3.Text == ("") || textBox2.Text == (""))
  61. {
  62. string title = "Arithmetic Series";
  63. MessageBox.Show("Error: Don't leave anything blank!", title);
  64. }
  65. else
  66. {
  67. start = double.Parse(textBox3.Text);
  68. end = double.Parse(textBox2.Text);
  69. if (start > end)
  70. {
  71. MessageBox.Show("Error: The start has to be less than the end!");
  72. }
  73. else
  74. {
  75. sum = ((end - start) + 1) * ((start + end) / 2);
  76. label7.Text = ("Sum: " + sum);
  77. }
  78.  
  79. }
  80.  
  81. }
  82.  
  83. private void TextBox3_TextChanged(object sender, EventArgs e)
  84. {
  85.  
  86. }
  87.  
  88. private void Label7_Click(object sender, EventArgs e)
  89. {
  90.  
  91. }
  92.  
  93. private void GroupBox1_Enter(object sender, EventArgs e)
  94. {
  95.  
  96. }
  97. }
  98. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement