CS304 assignment No 01 Spring 2017 Solution and Discussion | Virtual Study Solutions

Adsetra Ads

 

CS304 assignment No 01 Solution and Discussion

Here You can read CS304- Object Oriented Programming Assignment No. 1 Solution and Discussion Spring 2017 . CS304 assignment Deadline : April 27, 2017. Total Marks : 20.

Previously we shared : CS304 Assignment No. 1 Spring 2017.


CS304 assignment No 01 Solution and Discussion
CS304 assignment No 01 Solution and Discussion

CS304 assignment Instructions:

Please read the following instructions carefully before submitting assignment:

It should be clear that your assignment will not get any credit if:

  • The assignment is submitted after due date.
  • The assignment is submitted via email.
  • The assignment is copied from Internet or from any other student.
  • The submitted assignment does not open or file is corrupt.
  • It is in some format other than .doc (MS Word Document).
Please Note: All types of plagiarism are strictly prohibited.

For any query about the assignment, contact at CS304@vu.edu.pk

CS304 assignment Objective

The objective of this assignment is:
To give you the practical implementation of Class Diagram


For any query about the assignment, contact at cs304@vu.edu.pk

CS304 assignment No 01 Helping Material 

First of All You need to understand few basic concepts:

  • What is Association
  • What is Aggregation
  • What is Composition

What is Association

Association is a relationship where all objects have their own life cycle and there is no owner.

Let’s take an example of Teacher and Student. Multiple students can associate with single teacher and single student can associate with multiple teachers, but there is no ownership between the objects and both have their own life cycle. Both can be created and deleted independently.

What is Aggregation

Aggregation is a specialized form of Association where all objects have their own life cycle, but there is ownership and child objects can not belong to another parent object.

Let’s take an example of Department and teacher. A single teacher can not belong to multiple departments, but if we delete the department, the teacher object will not be destroyed. We can think about it as a “has-a” relationship.

What is Composition

Composition is again specialized form of Aggregation and we can call this as a “death” relationship. It is a strong type of Aggregation. Child object does not have its life cycle and if parent object is deleted, all child objects will also be deleted.

Let’s take again an example of relationship between House and Rooms. House can contain multiple rooms - there is no independent life of room and any room can not belong to two different houses. If we delete the house - room will automatically be deleted.

Let’s take another example relationship between Questions and Options. Single questions can have multiple options and option can not belong to multiple questions. If we delete the questions, options will automatically be deleted.



CS304 assignment No 01 Solution idea

by Syed Hasnat :

Question


Extract the main objects (entities) from the given scenario.
Solution:

(a):Car

(b):Sports Utility vehicle(SUV)

(c):Heavy Duty vehicle(HDV)
Question

Find the necessary attributes and functions that need to be associated with each object to implement the functionality mentioned above.

Solution:

Attributes:

(a):Engine

(b):GearBox

Functions:

(a):SetGear();

For HDV Load(); and UnLoad(); functions will be used.

Question

Identify the relationships between these objects.

Solution:

All the objects will inherit their attributes and function from Class ( Vehicle). The relationship between these objects is association because they all are independent.
Question

Construct a final comprehensive Class diagram showing all objects and their relationships along with their attributes and functions.
Solution:

CS304 assignment No 01 Spring 2017 Solution
CS304 assignment No 01 Spring 2017 Solution

Download CS304 Assignment No 1 Solution file

CS304_Assignment_no_1_Solution.docx

If You liked this Post Please share it with your friends. Thank You

Post a Comment

  1. Entities:-
    • Vehicles
    • Cars
    • Sports Utility Vehicles (SUVs)
    • Heavy Duty Vehicles (HDVs)
    Attributes:-
     Registration no.
     Model
     Color
     engine

    In last you have to make image in UML conventions

    ReplyDelete
    Replies
    1. plz send me soft copy ziahussain361@gmail.com

      Delete
  2. thora sa concepts ko samjh k phir question to study karo phir hi kuch samjh aye ga na. solution ka kia ha wo to upload ho jaye ga but abhi semester ka start ha and OOP k ye concepts bhot hi important hain agy project me ja k kafi help mily gi in se so in basics ko achy se zehn nasheen kijye

    ReplyDelete
  3. Prblm 2:
    Set_gear,loadng(),unloading()

    ReplyDelete

 

Top