Skip navigation.
Try to figure it out before asking for help

Chapter 3 Hints and Help

Chapter 3 is about preparing to develop applications by planning the algorithms and writing these up in pseudocode. You're not actually developing the applications yet. Since you're not writing code (HTML or PHP) so there's nothing to test or validate. We will start writing actual code in Chapters 4 and 5.

QUESTION: I'm not sure what to do. Can you walk me through a Fixit exercise?

ANSWER: If you open Fixit1 in your Chapter03 folder, you can see that two lines in the algorithm are in the wrong order:

Display age, yearsToRetire
yearsToRetire = 65 - age

That's because you can't place the instruction to display the yearToRetire before the instruction to calculate yearsToRetire. So you just change the order of these two lines and save the corrected file, that's it, you're done with this exercise.

QUESTION: Can you walk me through a Modify exercise?

ANSWER: Modify1 asks you to modify the algorithm provided so that it will also calculate the years worked worked so far, assuming the person started work at 18. So you need to modify the instructions, adding a new calculation and storing the result in a variable, then changing the "Display" instruction to also display this new value. Here's the solution:

Receive age from calcRetirement.html
yearsToRetire = 65 - age
yearsWorked = age - 18
Display age, yearsToRetire, yearsWorked

Note that the variable yearsWorked can be any name you want. Now save the file with your modifications, and that's it, you're done with this exercise. Note that for some Modify exercises you may need to make changes to the either or both parts of the algorithms. FOr example in Modify2 you'll need to change both the Modify2.html and Modify2.php sections.

QUESTION: Can you help me with the Complete Algorithm exercises?

ANSWER:The Fixit and Modify examples above should give you the help you need. For the Algorithm Creation exercises you will provide the complete instructions in the files provided. Note that there is no absoutely correct way to write an algorithm and your instructor may have special requirements. Once you get to Chapters 4 and 5 you will start writing the real code to convert these algorithms into working applications.