Scout to Scout: Programming Requirement 5a

Scout to Scout: Programming Requirement 5a

December 26, 2017 Merit Badge Programming Scout to Scout Uncategorized 0

The information below is provided by Mister Merit Badge Jr., a scout, with the purpose of helping other scouts understand the steps he had to take to complete the specific requirement.

Programming Requirement 5a: With your counselor’s approval, choose a sample program. Modify the code or add a function or subroutine to it. Debug and demonstrate the modified program to your counselor.

To do this requirement, I used the website repl.it, and choose the programming language C#.

repl.it is a really fun and interesting website to play around with and it can also be really useful. The site offers a online compiler or environment to write, build, and test your code for a multitude of different coding languages. The website also offers examples of code for each language.

After I picked C#, I looked at the example C# code repl.it had and found one that took a word entered by user, then it would repeat the word back to the user. This show me how C# handled inputs and outputs, which is most of what I needed to understand C# for my program, which I decided would ask the user for their age and the year they were born and then use those two numbers to guess the current year.

I ran into a minor problem because when the user inputs values from a console in C#, whatever they enter is saved as what C# calls a “string”, which is basically treated a word or text even if a number is used. So I had to figure out how to change the string to a number. I figured out how to do it by using Google, which can be a really helpful resource if you get stuck. With programming languages, there are a lot of really helpful people and websites on the internet. Once I figured out what I needed to do (String to Int conversion), I was able to complete modifying the code for the requirement.

If you’d like to see the program I wrote, you can see it below or at https://repl.it/@ekeown/NKRequirement5a. That reminds me, another great thing about repl.it is that it saves your code to share and let others view and run it.

Leave a Reply

Your email address will not be published. Required fields are marked *