-
Notifications
You must be signed in to change notification settings - Fork 0
/
Electricity.cs
69 lines (60 loc) · 1.97 KB
/
Electricity.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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading.Tasks;
namespace Calculatebill
{
public class ElectricityBill
{
int CustomerId,Unit;
string CustomerName;
double Charge,Amount,SurchageAmount,NetAmount;
public void GetCustomerDetails()
{
Console.WriteLine("Enter Customer id");
CustomerId = Convert.ToInt16(Console.ReadLine());
Console.WriteLine("Enter Customer's Name");
CustomerName =Console.ReadLine();
Console.WriteLine("Enter Unit ");
Unit = Convert.ToInt16(Console.ReadLine());
}
void CalculateAmount()
{
if (Unit > 600)
{
Charge = 2.00;
}
else if (Unit > 200 && Unit < 400)
{
Charge = 1.50;
}
else if (Unit > 400 && Unit < 600)
{
Charge = 1.80;
}
else
{
Charge = 1.20;
}
}
void CalculateBill()
{
Amount = (Charge * Unit);
SurchageAmount = (Amount * 15) / 100;
NetAmount = Amount + SurchageAmount;
}
public void ShowAmountDetais()
{
CalculateAmount();
CalculateBill();
Console.WriteLine("Customer's Id:{0}",CustomerId);
Console.WriteLine("Customer's Name:{0}", CustomerName);
Console.WriteLine("Cusumed Unit of Electricity :{0}", Unit);
Console.WriteLine("Amount charges @Rs.{0} per Unit{1}:",Charge,Amount );
Console.WriteLine("Surchage Amount:{0}",SurchageAmount);
Console.WriteLine("Net Amount Paid By the Customer:{0}", NetAmount);
}
}
}