- •Введение
- •1 Основания для разработки
- •2 Назначение разработки
- •3 Требования к программе
- •3.1 Требования к функциональным характеристикам
- •3.2 Требования к надежности
- •3.2.1 Требования к обеспечению надежного функционирования программы
- •3.2.2 Время восстановления после отказа
- •7 Код программы
- •8 Тестирование программного продукта
- •9 Разработка блок-схемы
- •Список использованных источников
7 Код программы
Код программы, предназначенной для расчета формулы 1 и 2 представлен ниже:
Forms1.cs
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 Второй_курс
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void label3_Click(object sender, EventArgs e)
{
}
private void label2_Click(object sender, EventArgs e)
{
}
private void label9_Click(object sender, EventArgs e)
{
}
private void label10_Click(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
Form2 f = new Form2();
this.Hide();
f.ShowDialog();
}
}
}
Forms4.cs
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 Второй_курс
{
public partial class Form4 : Form
{
public Form4()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void button3_Click(object sender, EventArgs e)
{
Form1 f = new Form1();
this.Hide();
f.ShowDialog();
}
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
if (!Char.IsDigit(e.KeyChar) && !(Char.IsControl(e.KeyChar)))
{
if (!(e.KeyChar.ToString() == "," && textBox1.Text.IndexOf(",") == -1) && !(e.KeyChar.ToString() == "-"))
e.Handled = true;
}
if (e.KeyChar.Equals((char)13))
textBox2.Focus();
}
private void textBox2_KeyPress(object sender, KeyPressEventArgs e)
{
if (!Char.IsDigit(e.KeyChar) && !(Char.IsControl(e.KeyChar)))
{
if (!(e.KeyChar.ToString() == "," && textBox2.Text.IndexOf(",") == -1) && !(e.KeyChar.ToString() == "-"))
e.Handled = true;
}
if (e.KeyChar.Equals((char)13))
textBox3.Focus();
}
private void textBox3_KeyPress(object sender, KeyPressEventArgs e)
{
if (!Char.IsDigit(e.KeyChar) && !(Char.IsControl(e.KeyChar)))
{
if (!(e.KeyChar.ToString() == "," && textBox3.Text.IndexOf(",") == -1) && !(e.KeyChar.ToString() == "-"))
e.Handled = true;
}
if (e.KeyChar.Equals((char)13))
button2.Focus();
}
private void textBox4_KeyPress(object sender, KeyPressEventArgs e)
{
if (!Char.IsDigit(e.KeyChar) && !(Char.IsControl(e.KeyChar)))
{
if (!(e.KeyChar.ToString() == "," && textBox3.Text.IndexOf(",") == -1) && !(e.KeyChar.ToString() == "-"))
e.Handled = true;
}
if (e.KeyChar.Equals((char)13))
button2.Focus();
}
private void textBox5_KeyPress(object sender, KeyPressEventArgs e)
{
if (!Char.IsDigit(e.KeyChar) && !(Char.IsControl(e.KeyChar)))
{
if (!(e.KeyChar.ToString() == "," && textBox3.Text.IndexOf(",") == -1) && !(e.KeyChar.ToString() == "-"))
e.Handled = true;
}
if (e.KeyChar.Equals((char)13))
button2.Focus();
}
private void textBox6_KeyPress(object sender, KeyPressEventArgs e)
{
if (!Char.IsDigit(e.KeyChar) && !(Char.IsControl(e.KeyChar)))
{
if (!(e.KeyChar.ToString() == "," && textBox3.Text.IndexOf(",") == -1) && !(e.KeyChar.ToString() == "-"))
e.Handled = true;
}
if (e.KeyChar.Equals((char)13))
button2.Focus();
}
private void textBox7_KeyPress(object sender, KeyPressEventArgs e)
{
if (!Char.IsDigit(e.KeyChar) && !(Char.IsControl(e.KeyChar)))
{
if (!(e.KeyChar.ToString() == "," && textBox3.Text.IndexOf(",") == -1) && !(e.KeyChar.ToString() == "-"))
e.Handled = true;
}
if (e.KeyChar.Equals((char)13))
button2.Focus();
}
private void button2_Click(object sender, EventArgs e)
{
double m, c, x, a, b, z, s;
m = Class1.Vvod(textBox1);
c = Class1.Vvod(textBox2);
x = Class1.Vvod(textBox3);
a = Class1.Vvod(textBox6);
b = Class1.Vvod(textBox7);
z = Class1.function1(x, m, c);
s = Class1.function2(x, a, b);
Class1.Vivod(textBox4, z);
Class1.Vivod(textBox5, s);
}
}
}
Forms5.cs
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 Второй_курс
{
public partial class Form5 : Form
{
public Form5()
{
InitializeComponent();
}
private void timer1_Tick(object sender, EventArgs e)
{
progressBar1.Maximum = 1000;
progressBar1.Value = 0;
for (int i = 0; i <= progressBar1.Maximum - 1; i++)
{
progressBar1.Increment(1);
label1.Text = progressBar1.Value.ToString();
label1.Refresh();
}
if (progressBar1.Value == progressBar1.Maximum)
{
timer1.Enabled = false;
Form3 f = new Form3();
this.Hide();
f.ShowDialog();
}
}
}
}
Class1.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Второй_курс
{
class Class1
{
public static double function1(double x, double m, double c)
{
double z = (Math.Sin(x) / Math.Sqrt(1 + m * m * Math.Sin(x) * Math.Sin(x))) - c * m * Math.Log10(m * x);
return z;
}
public static double function2(double x, double a, double b)
{
double s = Math.Exp(-a * x) * Math.Sqrt(x + 1) + Math.Exp(-b * x) * Math.Sqrt(x + 1.5);
return s;
}
public static double Vvod(TextBox t)
{
return Convert.ToDouble(t.Text);
}
public static void Vivod(TextBox t, double v)
{
t.Text = Convert.ToString(v);
}
}
}