-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathForm1.cs
96 lines (85 loc) · 2.44 KB
/
Form1.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
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 dialog_bill_calculter
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void btn_1_Click(object sender, EventArgs e)
{
double day, night,cost, total;
day = Convert.ToDouble(txt_2.Text);
night = Convert.ToDouble(txt_3.Text);
if(cmb_1.SelectedIndex == 0 )
{
if (day <= 50 && night <= 10)
{
cost = 800;
}
else if (day > 50 && night <= 10)
{ cost = ((day - 50) * 10) + 800; }
else if(day >= 50 && night < 10)
{
cost = ((night - 10) * 20) + 800;
}
else
{
cost = ((night - 10) * 20) + ((day - 50) * 10) + 800;
}
if (cost <= 1000)
{ total = cost + 250;
}
else
{ total = cost + 350;
}
txt_4.Text = Convert.ToString(total);
}
else if (cmb_1.SelectedIndex == 1)
{
if (day <= 10 && night <= 100)
{
cost = 1200;
}
else if (day > 10 && night <= 100)
{ cost = ((day - 10) * 20) + 1200; }
else if (day >= 10 && night < 100)
{
cost = ((night - 10) * 10) + 1200;
}
else
{
cost = ((night - 100) * 20) + ((day - 10) * 20) + 1200;
}
if (cost <= 1500)
{
total = cost + 350;
}
else
{
total = cost + 450;
}
txt_4.Text = Convert.ToString(total);
}
}
private void btn_2_Click(object sender, EventArgs e)
{
txt_2.Clear();
txt_3.Clear();
txt_4.Clear();
}
private void btn_3_Click(object sender, EventArgs e)
{
Application.Exit();
}
}
}