Professional Documents
Culture Documents
Part II
Nacho Iborra
...
4.4. Arguments
Functions should not have too many arguments. The ideal number of arguments is
between 0 and 2. Sometimes we may need 3 arguments, but whenever we use more than
3, we should find a good reason for it.
Regarding the argument names, you should follow the same rules explained for variable
names. In this case, arguments can't be public, so they usually start with a lowercase
letter.
public int SearchText(string wholeText, string textToSearch)
5.2. Exercise 2
Create a program in C# that lets the user specify:
A geometrical figure to draw (among square or rectangle)
A color to draw the figure (among red, blue and yellow)
The figure parameters:
Base and height for the rectangle
Side size for the square
According to the specified data, the program will print the corresponding figure. Use
Console.BackgroundColor to paint the figure using whitespaces of the chosen color.
Apply the rules learnt in this session (and in previous ones) to make your code as clean as
possible.