I know my quiestion is silly but I'm not good in Math:
I'm writing a program:
I want to count the consumption of water and electricity and phone calls. I know how i want it but i dont know how to translate it to C# statments
1- I created the method decimal getElect(Unit kw)
I want the consumption to be counted as the following:-
-----KW-------------------------Price---
The first 100 kw-------------5---------
The second 100 kw-------10--------
The third 100 kw-----------20--------
More than three------------50--------
I will explaine more, for example if the total kw=250 the way to count them is
the cost of the first 100 = 5*100
the cost of the second 100=10*100
the cost of 50 =50*20
total cost will be = 500+1000+1000=2500
==================================================================================
2- I created the method decimal getWater(unit m3)
I want the consumption to be counted as the following:-
-----M3-------------------------Price---
0 ....100---------------------5---------
100 ....200-----------------10--------
200....300------------------20--------
More than that---------------50--------
I will explaine more, for example if M3=150
the cost =150*10=1500
=====================================================================================