Skip to content

Simple calculator

For this part of the guided tour, we will build a travel calculator that can estimate your arrival time based on your current average speed and the remaining distance to travel.

Step 1: Understand what we want

To build a program you must know what you are trying to create. So what do we want as output from this program? The following is an example of what I am after:

What is your name: Andrew
Hi Andrew.
How far have you travelled so far? Enter km: 5.2
How long has it taken? Enter minutes: 7
Your average speed is 44.5714285714 km/h
How far do you have to go? Enter km: 57.3
You will take another 77.134615384615385 minutes before you arrive
Total distance will be 62.3 km
Total time will be 84.1346153846 minutes