You are on page 1of 5

Name : Asadullah

Reg no: 21104


Section: CD
Submitted to : Naqash sir

Task 1: Briefly explain the various paradigms of programming. What is the difference between
object-oriented paradigm and procedural programming?
ANS:

There are several programming paradigms, including procedural, object-oriented, functional, logic, and
others.

Procedural programming is a programming paradigm that follows a top-down approach, where a


program is structured as a series of procedures, or functions, that are executed one after another. In
procedural programming, the emphasis is on procedures or functions that manipulate data, which is
stored in variables. This paradigm is often used for tasks that involve data manipulation, such as
mathematical operations or file I/O.

Object-oriented programming, on the other hand, is a programming paradigm that focuses on creating
objects that contain both data and behavior. An object is an instance of a class, which is a blueprint or
template for creating objects. Objects can interact with each other through methods, which are
functions that belong to an object. Object-oriented programming emphasizes on the organization of
code into reusable, modular units.

The main difference between object-oriented programming and procedural programming is the way
they organize data and code. In procedural programming, data and code are separate entities, and data
is often passed between functions as parameters. In object-oriented programming, data and behavior
are encapsulated within objects, which can interact with each other through methods. Object-oriented
programming provides a way to organize code into reusable, modular units, which can make programs
easier to maintain and extend.
Task 2: This application will support the operations of a technical library for a university
department. This includes the searching for and lending of technical library materials, including
books, videos, and technical journals. All library items have registration code (research area
code + running number). Each borrower can borrow up to 10 items. Each type of library item
can be borrowed for a different period of time (books 6 weeks, journals 3 days, videos 1 week).
If returned after their due date, the employee will be charged a fine, based on the type of item
(books 5:-/day, journals and videos 20:- /day). Materials will be lent to employees only if they
have (1) no overdue lendables, (2) fewer than 10 articles out, and (3) total fines less than 100.
For this case, develop the following:
a) Draw a UML class diagram.
b) Conceptual/Domain Diagram – Sketch a UML sequence diagram explaining how the
various objects are communicating.

ANS:

| LibraryItem |

| -registration_code: str |

| -title: str |

| -borrower_id: str |

| -borrowed_date: date |

| -due_date: date |

| -return_date: date |

| +check_availability() -> bool|

| +calculate_fine() -> float |

| +get_item_info() |

| +set_borrower() |

| +set_return_date() |
| Book |

| -author: str |

| -publisher: str |

| -num_of_pages: int |

| +get_book_info() |

| ^ ^
| | |

| | |
| | |

| | |

| | |
| | |

| | |

| | | |
| | | |
| | | |

| Journal |

| -editor: str |

| -publication_date: date |

| -volume: int |

| -issue: int |

| +get_journal_info() |
| Video |

| -director: str |

| -length: int |

| -format: str |

| +get_video_info() |

Task 3: You are required to develop software for a car wash company. The company wants
software that can store the details of a vehicle and generate invoices. After due deliberation, it
was decided that a class called vehicle with the following members would be created.
Data members
(a) Registration Number
(b) Model
(c) Make(d) Year
(e) Name of the owner
Methods
(f) getdata() : Takes data from the users
(g) putdata() : Displays data
(h) init() : Initializes members
(i) del : Destructor
(j) capacity :
Create a UML class diagram to facilitate the development of the said software.

ANS:

| Vehicle |
| -registration_number: str |

| -model: str |

| -make: str |

| -year: int |

| -owner_name: str |

| +getdata() |

| +putdata() |

|+ init () |

|+ del () |

| +capacity() -> int |

You might also like