Object Oriented Programming (CSCT5110)

Computer Science - COS

Semester: Resit

Level:

Year: 2015

Page 1 of 2
SCHOOL: H.T.T.T.C DEPARTEMENT: CS LECTURER(S): Mr. DEMANOU YMELE
COURSE CODE: CSC412 COURSE TITLE: Object Oriented Programming OPTION: FCS 400
DATE: HALL: …….. TIME: 1h30 NATURE: Resit
INSTRUCTION: Answer all questions. You are reminded of the necessity for good English and orderly
presentation in your answers
1. i. Define the following terms:
a) Web service
b) Enterprise java bean
c) Entity
d) Facelet (1×4 mks)
ii. Differentiate between the following concepts
a) Stateful and stateless session been
b) Restfull and SOAP web service
c) Thin client and stand-alone client (1×3 mks)
2. i. Which type of session bean (stateless, statefull and singleton session bean is more
appropriate for each of the following situation:
a) The bean's state represents the interaction between the bean and a specific client
b) The bean needs to hold information about the client across method invocations.
c) The bean mediates between the client and the other components of the
application, presenting a simplified view to the client
d) The application needs an enterprise bean to perform tasks upon application startup
and shutdown (0.5×4 mks)
3. i. Consider two entities Teacher and Subject, represented on the table below. Assuming that
a Teacher is taught by many Subjects, add on the definition of those entities, the
appropriate annotation to set up their relationships (Hint: @OneToMany, @ManyToOne).
Teacher Subject
@Entity
class Teacher implements Serializable{
@Id
@GeneratedValue(strategy =
GenerationType.IDENTITY)
private Integer idTeacher;
(a)...
}
@Entity
class subject implements Serializable{
@Id
@GeneratedValue(strategy =
GenerationType.IDENTITY)
Private Integer idSubject;
(b)….
}
(1×2 mks)
REPUBLIC OF CAMEROON
Peace Work Fatherland
***********
THE UNIVERSITY OF BAMENDA
***********
HIGHER TECHNICAL TEACHER TRAINING
COLLEGE (H.T.T.T.C.) BAMBILI
***********
DIRECTORATE OF STUDIES
**********
P.O.BOX 39 BAMBILI
REPUBLIQUE DU CAMEROON
Paix Travail - Patrie
***********
UNIVERSITE DE BAMENDA
***********
ECOLE NORMALE SUPERIEURE
D’ENSEIGNEMENT TECHNIQUE
***********
DIRECTION DES ETUDES
**********
Tél: 33 05 10 69
www.schoolfaqs.net
Page 2 of 2
4. Considerer and application that is to be developed for registering patient in a clinic.
Assume that a patient has two attributes: name and birthday.
Patient
name (String)
birthday (Date)
i. Define and entity class for representing a Patient. You should provide for that class a
named query findAllPatients that searches for all Patients
registered in the clinic.
(2 mks)
ii. Propose and implementation of the enterprise bean “PatientBean” implementing the
business rules. PatientBean should include the following methods:
A method “registerPatient” for registering a patient
A method “searchByPatientName” that searches for the patient whose name is
transmitted as parameter (2 mks)
iii. Give an implementation of the backing bean (managed bean) “PatientMB” that binds the
server-side data to the facelet components (text field, button). This class should include a
method “process” to register a patient when the user sends the registration request by
accessing PatientBean. The method process must return the response page
“response.xhtml”. (2 mks)
iv. The welcome page contains two text fields and a submit button. The first text field
captures the patient’s name, while the second text field takes his birthday. When the user
click on submit, method process of PatientMB is called. The following is the welcome
page. Replace the labels (a), (b) and (c) by an Expression Language (Hint: The EL should
refer to PatientMB attributes (name, birthday) or method).
<h:body>
<h3>Field the patient’s name and birthday,
then click on submit
</h3><br/>
<h:form>
<h:outputLabel value="Name: "/>
<h:inputText value="…(a)…"/><br/>
<h:outputLabel value="Birthday: "/>
<h:inputText value="…(b)..." id="date">
<f:convertDateTime pattern="MM/dd/yyy"/>
</h:inputText><br/>
<h:commandButton value="Submit" action="…(c)…"/>
</h:form>
</h:body> (1×3 mks)
www.schoolfaqs.net