ArtsAutosBooksBusinessEducationEntertainmentFamilyFashionFoodGamesGenderHealthHolidaysHomeHubPagesPersonal FinancePetsPoliticsReligionSportsTechnologyTravel
  • »
  • Technology»
  • Computers & Software»
  • Computer Science & Programming

Programming - Let's do it!

Updated on January 18, 2015

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!

What we will do

  1. Solve our first Algorithm
  2. 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

  1. Check if we have a phone
  2. Look for the taxis number
  3. Deal the number
  4. Tell them where you are
  5. Wait
  6. Get in the taxi
  7. Tell the driver what our destiny is
  8. 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;

Algorithm Flowchart

The flowchart, is a graphic way of solving your problem.

Problem Flowchart

Comments

    0 of 8192 characters used
    Post Comment

    No comments yet.

    working