March 6, 2018
The code we just studied in class, slightly expanded and with an application program, is available to download.
You accomplished a lot since Milestone #1 (that was presented in Lab 07), so let’s take a moment to look back at what you learned.
.cs
files open in one project in VS (Lab 8 - Part I)ToString
method (Lab 12 - Part III)ToString
methods (Lab 12 - Part II)int
into char
, and reciprocally (Lab 14 - Part II)if
statements (Lab 14 - Part I)if
(Lab 14 - Part III)Math
class (Lab 10 - Part II)for
statement (Lab 14 - Part IV)Download, extract, compile and execute Course.zip. Then, read the code, and make sure you understand everything in it: the role of the static attribute, the difference between the two constructors, the branching in the constructor that takes two arguments. Then, do the following:
ToString
method that returns
ToString
method, so that the string returned describes accurately the section the student is enrolled in.Bonus: There is an inconsistency in the constructor that takes two arguments, can you spot it? What will happen if the user gave a code for the section that isn’t 'A'
or 'a'
, and section A is full? Can you fix this?