0% found this document useful (0 votes)
59 views

OOP Assignment 1

The document discusses an assignment for an Object Oriented Programming course. It provides submission guidelines for students to complete 4 questions related to OOP concepts like classes, objects, attributes, operations, encapsulation, and more. It encourages students to practice and work hard, stating "practice makes a person perfect". It also provides motivation quotes about pushing yourself and finding ways instead of excuses.

Uploaded by

Saad Mehmood
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
59 views

OOP Assignment 1

The document discusses an assignment for an Object Oriented Programming course. It provides submission guidelines for students to complete 4 questions related to OOP concepts like classes, objects, attributes, operations, encapsulation, and more. It encourages students to practice and work hard, stating "practice makes a person perfect". It also provides motivation quotes about pushing yourself and finding ways instead of excuses.

Uploaded by

Saad Mehmood
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Object Oriented Programming

UNIVERSITY OF CENTRAL PUNJAB, LAHORE


ASSIGNMENT 1
Course Title: Object Oriented Programming University: UCP
Course Instructor: Rana Waqas Ali Program Name: BS(CS), BS(SE)
Semester: Fall 2022 Date: 11-November-2022
Total marks: 40 marks Obtained Marks: _____________

Dear Students
Read the following lines at least 5 to 10 times before
starting the Assignment. Hope you will find motivation.

• Push Yourself Because, No One Else Is Going To Do It For You.


• If It Is Important To You Then You Will Find a Way, If Not, You Will Find An Excuse.
• The Secret Of Getting Ahead is Getting Started.
• Just Believe Yourself That You Can Do, Even If You Don't, Pretend That You Can Do,
At Some Time INSHALLAH You Will Do.
• The Expert In Any Thing Was Once A Beginner.
• Every Thing Seems Impossible Until It Is Done.
• Practice Makes A Person Perfect.

Submission guidelines:

• Q1, Q2 and Q4 should be written in the word file.


• Q3 should be done in visual studio/codeblocks or any other IDE which you like.
• Names of solution files should be like this: Q1_solution.docx, Q2_solution.docx,
Q3_solution.cpp, Q4_solution.docx
• All the solution files should be put in a single folder of your ID_Name_Section
• Zip the folder and submit it in your submission folder
• For example, Folder Name should be L1F20BSSE0206_Rana_Waqas_06
• Zipped folder will be L1F20BSSE0206_Rana_Waqas_O6.zip
• In case you have missed any lecture, you can watch my lectures on youtube using this
LINK

Best of Luck
Object Oriented Programming

Q1 Define Class and Object? Make classes for the objects in the following picture and write their possible
attributes and operation using the concept of Abstraction and Encapsulation. I need only class name,
class variables and class functions from you.
Object Oriented Programming

Q2. Is following diagram giving us concept of encapsulation. Explain your answer?

Q3: Write a complete Class called “Triangle”, which represents a mathematical triangle. (10 points)

The structure has the following instance variables:


1. base – double value representing the base of a triangle
2. height – double value representing the height of the rectangle

The structure has the following methods


1. Constructor - This constructor takes two formal parameters representing the base and height
respectively. The parameters are used to initialize the corresponding instance variables.
2. getBase - This method returns the base value.
3. getHeight - This method returns the height value.
4. setBase - This method updates the base value with the single parameter.
5. setHeight - This method updates the height value with the single parameter.
6. Area - This is a static method that takes as formal parameter a Triangle reference and returns a
double representing the area of the triangle.
Object Oriented Programming

Q4: Create a Car class. Identify the attributes and functions of the class (with respect to driver and not
engineer)

For Example:

Attribute: No. of Seats

Function: accelerate() or startCar()

Programming is Fun

You might also like