0% found this document useful (0 votes)
78 views4 pages

PE PRO192 Fall16 Sample

The document provides instructions for a sample test on Object-Oriented Programming with Java. It consists of 3 questions, each worth a certain number of marks. Question 1 asks students to design a Person class and Worker class that derives from Person. It also lists required member functions for each class. Question 2 asks students to design a Book class and MyBook class that implements an IBook interface. It also lists required member functions and methods. Question 3 asks students to design a Flight class with required member functions and details what a method in the Flight class should return. The output provided shows the number of test cases for each question and sample correct output.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
78 views4 pages

PE PRO192 Fall16 Sample

The document provides instructions for a sample test on Object-Oriented Programming with Java. It consists of 3 questions, each worth a certain number of marks. Question 1 asks students to design a Person class and Worker class that derives from Person. It also lists required member functions for each class. Question 2 asks students to design a Book class and MyBook class that implements an IBook interface. It also lists required member functions and methods. Question 3 asks students to design a Flight class with required member functions and details what a method in the Flight class should return. The output provided shows the number of test cases for each question and sample correct output.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 4

COMPUTER FUNDAMENTAL DEPARTMENT

HOA LAC

PRACTICAL SAMPLE TEST


Code Question:
SUBJECT: Object-Oriented Programming with Java (PRO192)1
Duration: 85 minutes

STUDENT INFORMATION

Name: Roll number:

Room No: Class:

FOR STAFF ONLY


MARK MARKED BY
Signature of Proctor
(Name and Signature)

INSTRUCTIONS
Please read the instructions carefully before answering the questions. Do not start until you are told to
do so.
 Students are allowed to use any books and materials.
 Students are NOT allowed to use mobile phone, Internet, Intranet, Yahoo Messenger, CMS,
USB, and all applications that help share information.
 Students are NOT allowed to transmit information and exchange materials with any other
during the examination period.
 Students must follow the following requirements (if not will get ZERO):
 Students have to copy PEAClient_Version4.zip to computer and use it.
PEAClient_Version4.zip is located on:
\\FSTU\Khao_Thi\03_Exam_Online
 For each question, create a folder in your computer that has two sub folder run and src.
Copy .jar file into run sub folder and all source file into src sub folder.
 For submitting, chose question number in PEA software, and then attack appropriate folder
was created. Click Submit button to finish submitting this question.
Exam code (Test name): PE_PRO192_Fall16_Sample, Paper No. 1

Question 1:

(3 marks) You have main function which is saved on folder named Q1 already. Use these classes
and functions to test all your operations in this question, DO NOT EDIT ANY CODE in main
function. You can add more operations/classes/interfaces to be able to answer the below questions.

Design and code a class named Person that holds information about a Person. Information of a
Person includes:
 A string describes the name of a Person.

Include the following member functions in your design:


 Constructors to set values for instance variables.
 Add needed operations to the class.

Design and code a deriving class named Worker from Person class that holds information about a
Worker. Information of a Worker includes:
 A whole value holding salary of a Worker.
 A String holding department name of a Worker.

Include the following member functions in your design:


 Constructors to set values for instance variables.
 Add needed operations to the class so that the main function can be run and complete the
below method which is declared in Worker class, the function will be used in second test
case.
o int getSalary() – this function return value of worker’s salary.

The program output might look something like:

No of test Correct output


case
2

1
Question 2:

(4 marks) You have main function which is saved on folder named Q2 already. Use these classes
and functions to test all your operations in this question, DO NOT EDIT ANY CODE in main. You
can add more operations/classes/interfaces to be able to answer the below questions.
We had provided you:
1. Interface – IBook which will declare some operations on Book – DO NOT EDIT this one.
2. You only need to complete the code in class MyBook and Book.
Design and code a class named Book that holds information about a Book. Information of a Book
includes:
 A string describing name of a Book.
 An integer value holding price of a Book.

Include the following member functions in your design:


 Constructors to set values for instance variables.
 Add needed operations to the class so that the main function can be run.

Design and code a class named MyBook which will implement interface IBook and complete 2
methods which were declared in IBook.
 String f1(ArrayList<Book> a) – assume that given list “a” is not empty. Write your java code to find
and return name of first book in given list “a”.
 int f2(ArrayList<Book> a, int price) – Write your java code to find and return the number of Books in
given list “a” which have price greater than or equals to given “price” (given price as input
parameter).

The program output might look something like:


Question 3:

(3 marks) You have main function which is saved on folder named Q3 already. Use these classes
and functions to test all your operations in this question, DO NOT EDIT ANY CODE in main
function. You can add more operations/classes/interfaces to be able to answer the below question.

Design and code a class named Flight, that holds information of a Flight, including:
 A string describes route of a flight as the format of “departure–destination”, for example
HAN-MNL or CDG-SGN…
 A whole number describes fare of a flight.

Include the following member functions in your design:


 Constructors to set values for instance variables.
 Add needed operations to the class and complete below method which is declared in Flight
class, the function will be used in second test case.
 String getDeparture() – this function return value of departure of a route.

The program output might look something like:

No of test Correct output


case
2

You might also like