Pages: [1]   Go Down
  Send this topic  |  Print  
Author
[EN] [PL] [ES] [PT] [IT] [DE] [FR] [NL] [TR] [SR] [AR] [RU]
Topic: Object Oriented Programming (CS304) Assignment No.5 Solution  (Read 744 times)
0 Members and 3 Guests are viewing this topic.
admin
Administrator
Hero Member
*****

Ranking: 200
Offline Offline

Posts: 16074


Looking for some members that can help other students in Studies


« on: January 28, 2011, 03:04:31 PM »

Object Oriented Programming (CS304)
Assignment No.5





Deadline
Your assignment must be uploaded before or on 3rd  Feb, 2011
 

Rules for Marking
It should be clear that your assignment will not get any credit if:
o   The assignment is submitted after due date
o   The assignment is copied


Objectives
The objectives of this assignment are,
o   Practically implementing Object Oriented concepts using c++.



Assignment

Introduction:

In Assignment No.4 we added basic code in header and implementation files in the form of necessary attributes with suitable data types along with Constructor, Destructor and Getters/Setters for all data members as well as some important member functions of that particular class like student, Library etc in Library Management System.

In this assignment we will finalize our coding by adding different relations among the class you have already developed in last assignment and at least one more class mentioned in “Object Model” (see assignment #1 for object model)  class/s, and writing main program for our Library Management System.



Note: Revise your Object Model and made changes where required before going to implement as now you have much more understanding about the domain and constructs used in developing Object Model.
Below is the guidelines and revision of these concepts along with examples that are necessary to develop Object Model.

Associations used in Object Model:
As discussed in previous assignments there are three types of associations that may exist between two classes,

•   Simple Association
•   Composition
•   Aggregation




Simple Association:

We say that simple association exists between two classes in our model when there is no intrinsic (dependency) relationship between two classes, however they are taking services from each other, for example a person and a car or a person and a house. In our current System it this type of association may exist between,

•   School and Electricity Company
•   School and Private Bus Service
•   School and Courier Service
•   and so on…

We use line to indicate simple Association between two objects as shown below (it may have no arrow head (two way association), or it may be unidirectional (one way association),
 
When there is some essential relationship (intrinsic relationship) between two objects then we have either Composition or Aggregation between these two objects as described below,


Composition:
Composition is simply the case when one object is composed of other objects and these objects have no significant independent existence.

We use the following symbol for composition,

 

Examples of composition include,

a.   Computer system and its parts like processor, ram and motherboard
b.   Book and its pages
c.   School bag and its handle and pockets
d.   School and Class
e.   School and Library (considering library is part of school and can not exist independently)
f.   Class and Subjects (as this is school so each class has specific subjects in a college or university a single subjects may be added to different study programs)
g.   Library and Librarian
h.   Grade Book and Subject Marks


Aggregation:
Aggregation also refers to collection of objects, but in case of Aggregation composing objects have their independent existence as well. Its examples include,


a.   Library and Books,
b.   School and Teacher(As teacher may exist independently as well)
c.   School and Student(As student may exist independently as well)
d.   Grade Book and Subjects
e.   Student and borrowed book
f.   Teacher and borrowed book


Note that all these objects have relationship with each other but they may exist independently also, we use the following symbol for aggregation,
 






 
C++ Implementation

Now we see how we can implement these associations present in our Object Model using C++,

1.   Simple Association:
It can be implemented by sending messages from one object to another as this type of association does not involve any type of containment.
2.   Composition:
Composition is achieved by adding declaration of object of one class in other object.
3.   Aggregation:
Aggregation is implemented by placing the reference (pointer array) of the aggregating class objects in the class where they are aggregated.

We discuss some important relations present in our Object model,


1.   Library has Book
As library aggregates books we will create array of books objects in library class that will independently exist throughout the program.

2.   Teacher / Student borrows Book
When teacher or student will borrow book we will set his name in books issued to attribute.

3.   Librarian issues Book
When teacher or student will request to borrow some book librarian will issue the book by setting issues to property of Book class.

Helping Guidelines:


1.   It will be better if you go step by step, first add two classes and implement their relationship and then move forward to add one more class if required.

2.   

3.   This development will definitely help as it will show how to work in classes and how to implement association relationships and how to create main flow of program. However note that your solution should be better than this as you now have this solution.







Assignment Submission Instructions:

You have to upload your complete project folder in zip format.

Logged
Pages: [1]   Go Up
  Send this topic  |  Print  
 
Jump to:  

Get Daily Ayat & Ahadith. To subscribe simply write JOIN ysa1 in sms send it to 8002. for Quotation, Recipes, Joke, Words alerts click here


Powered by SMF 1.1.13 | SMF © 2006-2011, Simple Machines LLC | Page created in 0.202 seconds with 21 queries.