0% found this document useful (0 votes)
69 views6 pages

It1050 Ooc

The document provides instructions for a final examination for the subject "Object Oriented Concepts". It contains instructions for candidates regarding the exam structure, duration and content. The exam contains two questions - the first question has multiple sub-questions related to object oriented programming concepts like classes, objects, attributes etc. and the second question involves noun-verb analysis and class modeling.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
69 views6 pages

It1050 Ooc

The document provides instructions for a final examination for the subject "Object Oriented Concepts". It contains instructions for candidates regarding the exam structure, duration and content. The exam contains two questions - the first question has multiple sub-questions related to object oriented programming concepts like classes, objects, attributes etc. and the second question involves noun-verb analysis and class modeling.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Sri Lanka Institute of Information Te hnology

'B.Sc. Honours Degree in Information Technology


Specialized in Information Technol gy

Final Examination
Year 1, Semester ~ (2018)

ITI050 - Object Oriented Concepts

Duration: 2 Hours

October 2018

Instructions to Candidates:

• This paper is preceded by 10 minutes reading peri d. The supervisor


will indicate when answering may commence .
•. This paper has A"41iestions.
• Answer all questions in the booklet given.
• The total marks for the paper is 100.
• This paper contains 6 pages, including the cover p ge.
• Electronic devices capable of storing and retrievin text, including
calculators and mobile phones are not allowed. '
Question 01 (40 marks)

a) Explain the difference between a "Structure" and a "Class" in C++by iving examples?
(3 marks)

b) Briefly explain the steps of building an object oriented program. (2marks)

c) Readthe description given below and answer the questions

I A university issues ID cards ( Identity Cards) for its staff and visitors to provide access to
University facilities. Every staff ID will be valid for a year from the dat of issue. It has to be
updated every year. However, the visitors' cards are issued on daily basi .

Kamal is an undergraduate student following Bachelor of Information T chnology in the Faculty


of Computing. Mr. Perera was the first visitor ( ID == 001 ) who came to the university premises
on the 20th March 2017. He came to the university for a meeting w'th Dr. Ajith Pieris ( ID:
312353), the Head of the Software Engineering Department. Dr. Ajith Pi ris joined the facility as
a Senior Lecturer on 30th September 2015. Dr. Amal Perera is a Senior Lecturer attached to the
Engineering Faculty and his ID number is 234567. He joined the uni ersity on 1st of January
2018.

i) Identify the classes,objects and the attributes in the scenario abov ,and write in a table as
shown below. ( 6 marks)

Classes Objects Attributes

ii) Briefly explain the terms below by taking examples from the scerario given above.
(6 marks

1. Abstraction
2. Encapsulation
3. Information Hiding

Page1 of 5
d) Consider the UML diagram of a classshown below;

Item
- itemlD : int
- name: char []
- price: double
.
+ ItemO
.. + Item( pid : int, pname : char[])
+ setPrice( pprice : double) : void
+ getPrice( ) : double
+ display () : void

i) Write the coding in C++for the class Item represented above (3 marks)
ii) Write the overloaded constructor of the class Item. (2 marks)
iii) Implement the setPriceO method and the getPriceO method (2 marks)

e) Consider the following classes.

class A class B
i)
private private
- int numl; int num2;
public : public :
void setNum(int nl ); void set um(int n2 );
void add ( B b); int getN m ();
void display();
. }; } ;

Write the method add() of classA where an object


of class B is sent as a parameter to the method. litis method will acd the value of num2 to
numl in classA. ( 2 marks)
ii) Write a client program to create a static object of class A and call the methods add() and
display() of classA.
(3.5 marks)

Page2 of 5
iii) Create another object of class A using dynamic Memory allocation nd display the details
appropriately. (You can set numl to 10 and num2 to 20 ) (3.5 marks)

f)
.
Consider the UML diagram given below .

Order OrderDetail
-date: Date
-status : string -quantity: int
-price : c}ouble k> -taxStatus : string

1 1..*
.+calcSubTotaIO : void +calcSubTotalO : void
+caIcTax( ) : float +calcTax( ) : float
+calcTotal( ) : double

i) What is the relationship that exits between these two classes (2 marks)
ii) Write the necessary C++ coding of the two classes. (5 marks)
( You are not required to implement the methods)

Page 3 of 5
Question 02 (15 marks)

a) Consider the following scenario. Do the Noun Verb analysis to identify the classes in the
description. Show clearly how the nouns were rejected using the above rules. (5 marks)

A program isneeded to be implemented to handle the rentals paid by the tenants ( the person
who occupies the room) in a small apartment building. The landlord (owner of the building)
should be able to input the rents paid by individual tenants and also the xpenses incurred in
operating the building. The expenses could be for electricity, water and any repairs done to the
building. The program should be able to display a rent record, which sows t e rents paid by each
tenant for each month, and an expense record, which for each expense rec rds the date, payee,
amount and budget category. The program should also be able to display an annual summary,
which shows total rents paid for the year and total expenses paid in each budget category.

In addition to the above requirements, the landlord wants to keep track of t e basic information
of the tenants such as the name, NIC no, contact details, and details about the rental contract such
as the room number, the joined date and the expected period of stay. The er should be able to
search for details by entering the name or the NIC number of the tenant.

b) Consider the classes identified above and draw the CRC cards for 5 selected classes.

(10 marks)

Question 03 (20 marks)

Read the following .description and identify the classes, attributes, methods a d relationships
between classes; multiplicity specification. Draw a UML class diagram for t e following
scenario using the above features.

Five doctors with three trainee nurses run the "Health First" Medical Center. When a patient
calls for an appointment, he or she usually sees the same doctor, but at bus times, patients may
see any of the doctors or nurses. -:iUnce a patient has been seen by the octor or nurse, the
medical records a e updated and the doctor may also write or a prescri tion for the patient.
Sometimes the doctor considers that the patient needs further tests. Thes may be routine or
intensive. They are carried out at one of the local hospitals.

The Medical also has an emergency unit with four beds that can be u ed by patients with
emergency cases or minor injuries. One doctor is in charge of the emelgency' unit with the
support of a nurse. A patient can be. referred to the local hospital in case of further treatment or
for consultation of a surgeon.

Page 4 of 5
•.

Question 04 (25 marks)

Consider the following class diagram and write the coding for the classes shown in the diagram
considering the relationship among them. You are not required to writ any methods for the
classes.

Hospital
1 1
I
..••..
....••.. -name: String ..•....
",....
-address: String
. -phone: String

*
1..*
Ward

Team -nam : String


-gend r : String
.-----t +name : String -capacity: integer
0..1 1
1
1..* ~.

1
*
Doctor
Patient
#Specialty ; String[] *
#Iocation ; String[J -id : String
-gen er: String
* -age: int
-acce ted: Date
-sickness: String[J
-pres ription :String[J
-allergies: String[J
-spec alReq : String[]
",
Consultant Doctor Junior Doctor
- -fee: double -hours : int *
1

Page 5 of 5

You might also like