Programming Exercises

   


1:

Recall your first object-oriented source code SimpleElevatorSimulation.cs in Listing 5.1 of Chapter 5, "Your First Object-Oriented C# Program." It contained three classes in the same compilation unit. In hindsight, it didn't follow the standard convention of one class per compilation unit. Rectify this problem and rewrite the program so that it more correctly contains three compilation units, each with its own class (Elevator, Person, and Building) and all classes properly structured inside a neat namespace hierarchy. Turn these three compilation units into a DLL assembly. (Hint: You should rename the Main method from the Building class, because this new DLL is for reuse only). Write another source file that performs an Elevator simulation similar to that performed by our original program, but this time it uses the namespaces and their classes located in the DLL assembly you created before from the three classes.

2:

Perform the same type of exercise as exercise one, but this time use the BankSimulation.cs source file in Listing 10.14 of Chapter 10, "Arrays Part I: Array Essentials," as the basis. Write one compilation unit for each of the two classes Account and Bank and put them in a suitable namespace hierarchy. Compile this part into a DLL assembly. Write the source code for a bank simulation program that uses the namespaces and classes of the created DLL assembly. The functionality of this program should be identical to that of the program we originally created from Listing 10.14.


   


C# Primer Plus
C Primer Plus (5th Edition)
ISBN: 0672326965
EAN: 2147483647
Year: 2000
Pages: 286
Authors: Stephen Prata

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net