It’s been a while so here is a basic app that will allow the calculation of how petrol price based on distanced traveled.

This is done via the following:1
2
3
4
5
6
7
8
9
10
11
12
13
14
15int distance;
distance = int.Parse(txtboxDistance.Text);
double price = 0;
if (distance <= 8)
{
price = distance * 0.50;
}
else if (distance > 8)
{
price = 8 * 0.50 + (distance-8) * .30;
}
price = double.Parse(price.ToString());
txtboxCost.Text = price.ToString();