Who even likes math?! [#1 Programming Blog]

in programming •  7 years ago  (edited)

Hello there, would you like full access to the source code of an Android app, for free?

Here you go.

android_800_thumb800.jpg

Why would I give my privately developed application away that easily?

Because I've created it for private use. I never intended to make any money out of it. In fact, I've used the app just an hour ago.

What does it do?

Math-1.jpg

I can do math as well!

But do you like to? Probably not. I'll give you a little context here.

My sister and I share a car. We drive it regularly, but not equally as much as one another. We decided to split the bill for gas based on how much we drove until we have to refuel. This may sound really simple, and it is, but it takes time. Boy does it take time.

Version 1

Try to imagine this. Every time you get in the car and start driving, you keep track of how many kilometres (KM) you drove (one kilometre is about half a mile). You enter the amount of KM in some kind of note app, like Google Keep. So far, so good. This is doable. There is however, one flaw with this plan already. Kilometres on a highway are much cheaper on gas than kilometres in a small town where you continuously use the brake and accelerate.

Version 2:

So now we keep track of where we are, and the amount of KM we drive. We write down something like

10 KM (kilometres): inside

with 'inside' meaning inside of a town. The other options are 'outside' and 'average' for a mixed ride.

The Bill

This is where it gets cumbersome. Math. If you do not care about the math, and just want to get to the part of where I showcase the app, skip this chapter until 'Showcase'.

Let's picture a situation. After 4 weeks of driving, I have acquired the next few statistics:

36 KM: inside
54 KM: average
87 KM: outside

My sister gives me her stats:

26 KM: inside
35 KM: average
104 KM: outside

The gas tank is empty. I decide to go and refuel.

The refuel cost me 41 euros (EUR).
1 liter = €1,30 (a liter is roughly a quarter of a gallon, one € is, well, fluctuating obviously)

(For simplicity, let's say the trip to the gas station was already added to our stats.)

This leaves us a situation in which my sister has to pay something, because I paid the full price up front. How do we know how much she drove for?

Calculate the amount of liters she drove, in gas, then multiply that amount by 1,30 (gas price).

Let's go ahead and do that.
We looked up some numbers on the internet. Our car uses:

0,109 liters to drive 1 KM inside.
0,082 liters to drive 1 KM average.
0,069 liters to drive 1 KM outside.

Now we take the numbers she gave me, multiply by these variables, and we have the amount of liters she drove.

0,109 * 26 = 2,834 liters
0,082 * 35 = 2,87 liters
0,069 * 104 = 7,176 liters
Total: my sister drove 12,88 liters in the past 4 weeks

Using the same calculations, I drove 14.355 liters in the past 4 weeks.

Results

Sister: 12,88 * 1,30 = €16,74
Me: 14,355 * 1,30 = €18,66

Now these numbers will never exactly represent real life driving usage, sometimes you will brake more often, sometimes you will accelerate more, etc. This leaves us with the little inaccuracy of

Total cost: €41
€41 - €16,74 - €18,66 = €5,60

To keep it fair to the both of us, we'll split this amount. This leaves my sister to pay me

(5,60 / 2) + 16,74 = €19,54

€19.54.

Let's think about that number for a second. It took us like 15 minutes to get to that number. 15 awful minutes. All of this can be done by a computer, with some user input beforehand (like the gas price).

So that's what I did.

That's what the app does. It calculates all of these things.

Showcase

Every step is covered.

On a sidenote, hold down a record on the home page if you'd like to edit or delete it.

screenshot_1.png

screenshot_2.png

screenshot_3.png

screenshot_4.png

Do you like this type of content?

Make sure to follow @edwinvanrooij for more!

Disclaimer

The app is published under the MIT license.

In my first few posts, I'll continue to add my verification photo at the end, for the people who missed my introduction post.

Me_introduction.jpeg

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Good post!

Very useful app!
Are you going to put it in the google play or apple store?

It's on Google Play! However, only published in the Netherlands.

If you'd like, I can create an APK file so anyone can install it. However, I think not many people will use it in exactly the way I do. That's why I released the code, so anyone can fork and edit it to suit their own needs.

Congratulations @edwinvanrooij! You have completed some achievement on Steemit and have been rewarded with new badge(s) :

Award for the number of upvotes

Click on any badge to view your own Board of Honnor on SteemitBoard.
For more information about SteemitBoard, click here

If you no longer want to receive notifications, reply to this comment with the word STOP

If you want to support the SteemitBoard project, your upvote for this notification is welcome!