Back

Code Challenge: Locker Combo

Difficulty  

divider

The Brief

What they asked for
Every year I forget my locker combination within about a
week. I want something I can run that asks me the three
numbers and then prints them back in a way I can actually
screenshot and keep, with my locker number on it, because
I forget that too.

Write your requirements list before you write any code. Input, calculate, output, and anything you had to decide for yourself.


Notes

  • Four things get typed in, not three. Read the brief again.
  • The output is the whole point here. Make it something a person would actually screenshot.
  • Do not do any arithmetic in this one. It is entirely about collecting input and printing it clearly.

Where to Start

Only one-star challenges have this section. If you already know how to begin, skip it — and when you move up to two stars, working out the order yourself is part of the job.

  1. Four prompts, four variables, all read with Console.ReadLine().
  2. Print them back one per line first, just to check they came through.
  3. Then format them the way the sample shows.
  4. Nothing here needs int.Parse — you are not doing arithmetic on them.

Sample Output

Sample Output
Locker number: 2418 [Enter]
First number: 34 [Enter]
Second number: 12 [Enter]
Third number: 07 [Enter]
=========================
LOCKER 2418
34 - 12 - 07
=========================

Notice that 07 came back out as 07 and not as 7. Think about why that is, given what you typed in and what you did not do to it.


Submit

Your requirements list and your program file, named cc-locker-combo.

Commence Challenge