Object Oriented Programming using C#

(backadmin) #1
Object Oriented Programming using C#
Case Study

Note it is possible that a client could not be found – hence the try catch block in the code above. This will be discussed
in the next section.

11.9 Programming the Client Classes


The system needs a Client class, with methods to decrease the client’s credit (when a message has been displayed for
them). Ultimately it will also need a method to allow a client to pay for and increase their credit but we will not add this
functionality in the first version of this system. This class is simple and is very similar to programming the Message class
and is therefore not shown here.

Programming the ClientBook class is also similar to programming MessageSet, class however there are a few significant
differences :-
• All clients have a ClientID so ClientBook uses a sorted dictionary instead of a Set.
• The method GetClient() could fail if no client exists with the specified ClientID. We need to build in
protection in case a client cannot be found.
• The method AddClient() could also fail if a client already exists with the specified ID.

The complete ClientBook class (without comments) is shown below. By downloading the finished program this code can
be viewed with embedded comments.



 
  


In Paris or Online
International programs taught by professors and professionals from all over the world
BBA in Global Business
MBA in International Management / International Marketing
DBA in International Business / International Management
MA in International Education
MA in Cross-Cultural Communication
MA in Foreign Languages
Innovative – Practical – Flexible – Affordable
Visit: http://www.HorizonsUniversity.org
Write: [email protected]
Call: 01.42.77.20.66 http://www.HorizonsUniversity.org

Please click the advert

Free download pdf