Week 16: Final project

C# code typing course. 25 wpm, 95% accuracy.

This last week brings everything together. Every symbol you learned in the course appears in one program: a number guessing game. The program picks a secret number, the user makes guesses, and each time the program says whether the guess is too high or too low. The game uses parentheses, quotes, comparisons, the plus and equals signs, and semicolons, often on neighboring lines.

What you will learn

The game has two basic parts: generating a random number and reading the user’s guess. To turn the typed guess into a number, you use Convert:

Random random = new Random();
int secret = random.Next(1, 101);
  • random.Next(1, 101) returns a number from one up to one hundred. The lower bound is included and the upper bound is not.
  • int guess = Convert.ToInt32(Console.ReadLine()); converts the line the user typed into a whole number and stores it in guess.

This week introduces no new symbols. You use parentheses, quotes, comparison symbols, plus, equals, percent and semicolons from throughout the course. If you forget where one of them sits on the US English layout, return to its lesson.

Technique tips

  • Break the program into small pieces and type each in its own rhythm: first the random number, then reading the guess, and finally the comparison.
  • Glance at the next line before you type the current one. That keeps the flow of the program steady.
  • Enter fills in the next line’s indentation. Let Enter carry the indent through the blocks instead of retyping it.

Lessons

  1. Learn (10 to 15 minutes): Watch the demo of the game’s first two parts, say what each line does, and type them several times.
  2. Practice (10 to 15 minutes): Type the whole game from start to finish. Check the closing brace of every block as soon as the block ends.
  3. Review (10 to 15 minutes): Take the two-minute test. Note which line slowed you down and go back to it in one last review.

This week’s goal

The goal this week is 25 WPM with 95 percent accuracy, the highest target of the course. Stars work like this: finish the lesson for 1 star, reach 95 percent accuracy for 2 stars, and reach 25 WPM as well for 3 stars. Accuracy comes first, because one missing symbol stops the whole game from running.

This week’s lessons

Do the lessons in order. Each one ends with a test, and your best result is saved.

  1. Lesson 1: Learn

    Keywords

    12 minutes

    Start
  2. Lesson 2: Practice

    Practice

    12 minutes

    Start
  3. Lesson 3: Review and test

    Review and test

    13 minutes

    Start

All weeks