Code Exercise 08 Solution

Setup:
You will be creating a new Visual Studio project named "FirstnameLastname_CE08" using the C# Console Application template.

Grading:
Please refer to the CE:08 tab of this rubric to understand the grading procedures for this assignment.

Deliverables:
You will compress and upload a file named "FirstnameLastname_CE08.zip" with the following contents with the following names:

●     Project - Folder containing your entire project and all files necessary to build the project(csproj, .cs files, App.config, and Properties folder).

 

Be sure to upload the correct project and all required files the first time as only one submission will be allowed.  No extra time or consideration will be given if the wrong files are uploaded.

Instructions:
For this assignment you will create a method that takes in two parameters: an array of strings, and a boolean. This method’s body will sort the array of strings using an insertion sort algorithm in either ascending or descending order based on the boolean parameter passed to the method. Strings have an inherited method called CompareTo that can be used for determining the sort order of two strings, more information on this method can be found on the MSDN. In addition to the provided research resources the gif from the wikipedia page for insertion sort provides a visual demonstration of what should be happening in the insertion sort. Writing the array to the console throughout your sort may help you to catch any issues with your sort.

 

The following guidelines are the grading categories for this assignment:

 

Sort Features

●     Able to sort strings.

●     Can sort in either ascending or descending order.

●     The sort is its own method that takes in a string array parameter and a boolean parameter.

Insertion Sort

●     The sort algorithm implemented is an insertion sort.

 

Extra Information

Go back through your code and check for the following:

●     All variables and methods are named appropriately.

●     Member variables should have either protected or private access.

●     Anytime the user is asked for input the expected input is made clear to the user.

●     Any information being output to the user should be clear and concise.

●     The user should be clearly informed of what is occurring throughout the application. When values change or objects are instantiated information about this occurrence should be displayed.

●     Make sure nothing accesses an object that doesn’t exist.

 
Powered by