Programming - Let's do it!
Programming is an amazing art and will help you other than making money, solving many daily life issues, because programming is the art of solving problems, that's what we do!
Before you read this hub, make sure you read my previous one to get a better idea of what I'm talking about
- Programming - What's that? Can I do it?
A programming language is the language the developer uses to communicate with the computer.
What we will do
- Solve our first Algorithm
- Take a look at flow charts, they help us organizing our program and getting a better and cleaner code
1st Problem -- Call a Taxi
So what do we need to call a taxi?
- A phone
- The taxis number
1st Problem -- Algorithm
- Check if we have a phone
- Look for the taxis number
- Deal the number
- Tell them where you are
- Get in the taxi
- Tell the driver what our destiny is
- Leave the taxi
1st Problem -- Variables
phone -- boolean
taxis_number -- integer
valid_number -- boolean
taxi -- boolean
Let's code the problem!
If (phone == TRUE and taxis_number >= 0) then valid_numer = TRUE; If (valid_number == TRUE) then taxi = TRUE;
Did you get it?
Let me explain:
We need to verify if there is a phone and if the phone number is bigger than 0 (everybody knows that a phone number has at least 9 numbers):
If (phone == TRUE and taxis_number >=0)
Now that we have the right number:
If (valid_number == TRUE)
We just need to call the taxi:
taxi = TRUE;
The flowchart, is a graphic way of solving your problem.