Primary Objectives:

  1. Install and use Visual Studio
  2. Learn C#
  3. Be able to write a moderately complex C# console program using "C-sharpese"
  4. Continue to hone your Git skills

Overall Requirements:

  • Use Visual Studio 2017 ONLY (the free Community Edition is just fine)
  • Your C# version should produce identical results to the given Java version when run from the command prompt
  • All C# code must be commented with XML comments at least as much as the Java code has been with Javadoc comments
  • Do NOT use Git commands from within Visual Studio. You may only use the command line for Git.

"As a student in CS 460 I want to write an example C# application so I can prove that I know the C# language and can work in the professional Visual Studio environment."

Questions/Tasks:

  1. Get your development environment set-up: download and install Visual Studio 2017.
  2. Download the Java application provided here: javacode.zip. Review the code, read the java lab handout, and compile and run to learn what it does.
  3. Your job is to replicate this Java program but in C#. You should write a C# console application from scratch that does exactly what the Java version does. Do not copy and paste the code. Type it in and translate as you go. Let me repeat. DO NOT COPY, PASTE and then TRY TO FIX THE ERRORS!
  4. Start a new C# console application whose code is inside a HW3 folder in your Git repository. Add and commit your project files and code just like normal, but do use Visual Studio's .gitignore file so that the multitude of unnecessary files are not shouting to be added to Git. As with the last homework, all work for this homework should be done in a new feature branch.
  5. Write C# class files and code as necessary to duplicate the behavior of the required code. Don't try to copy in the Java code and edit it. You want to write it from scratch so you begin to learn the Visual Studio IDE style of development (i.e. code completion, IntelliSense, looking up documentation, keyboard shortcuts ...). You should have multiple commits showing how you wrote this from scratch.
  6. Where the syntax is identical between C# and Java you of course do not need to change anything. However, C# makes use of new language features to solve common tasks and you should use those (looking at you properties). Little things are important, for example C# has a String class but convention says you use the string type name -- so please do that. Please follow all C# conventions for naming things (names that start with upper case for example). The code does not have to be exactly the same as long as the behavior is the same. Don't worry about making accessibility modifiers the same.
  7. When finished with your nicely commented, professional looking code, add a new page for it to your Portfolio (with screenshots to demonstrate it in action), and make sure it is pushed to your remote repository.

Important

To reiterate the purpose of this homework, we want to learn as much C# and Visual Studio as possible this week. Don't get lulled into thinking it's just the same as Java and so you don't need to learn anything. It is its own language and Visual Studio is a large and complicated IDE. It is a larger and richer language than Java and we want to use those features. It has some quirks. It has namespaces, extension methods, lambda functions and in and out variables. Surprisingly, I didn't think I'd like it but I do. Between Java and C# I'd much rather write in C#.