Back

Code Challenge: Name Badge

Difficulty  

divider

The Brief

What they asked for
Everyone at the open evening needs a printed badge. Same
layout every time, just a different name and role on
each one. I have about forty people.

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


Notes

  • One method, called forty times — or three, to prove it works.
  • The badge layout lives in one place. If the border line appears in your file more than twice, you have copied the layout instead of calling it.
  • Two things change per badge. Those are your parameters, and both are strings.
  • Type the names in capitals in your calls. Turning text into capitals is a tool this course has not taught yet.

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. Write one badge with four Console.WriteLine lines, with the name and role typed in.
  2. Move those four lines into a void method that takes two string parameters, and put the parameters into the two middle lines with $"...".
  3. Call it three times with three different people.
  4. Count the border lines in your file. There should be exactly two.

Sample Output

Sample Output
===========================
AVERY OKONKWO
Robotics Club
===========================
===========================
BLAKE RIVERA
Debate Team
===========================

Your border can be any characters you like, as long as every badge uses the same one.


Submit

Your requirements list and your program file, named cc-name-badge.

Commence Challenge