0% found this document useful (0 votes)
6 views3 pages

Midterm 2021

The document outlines the midterm examination for the Object-Oriented Programming course at International University - VNUHCM, scheduled for November 13, 2021. It includes instructions, grading criteria, and a series of questions focused on object-oriented programming concepts and practical coding tasks. The exam accounts for 30% of the course grade and requires students to demonstrate their knowledge and skills in class design and implementation.

Uploaded by

Ten Ten
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)
6 views3 pages

Midterm 2021

The document outlines the midterm examination for the Object-Oriented Programming course at International University - VNUHCM, scheduled for November 13, 2021. It includes instructions, grading criteria, and a series of questions focused on object-oriented programming concepts and practical coding tasks. The exam accounts for 30% of the course grade and requires students to demonstrate their knowledge and skills in class design and implementation.

Uploaded by

Ten Ten
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/ 3

International University - VNUHCM

School of Computer Science and Engineering


-----------------

Midterm Examination
Date: 13/11/2021; Duration: 90 minutes
Online; open book exam

SUBJECT: Object-Oriented Programming (IT069IU)


Approval By the SCSE Lecturer:
Signature Signature

Full name: Nguyễn Văn Sinh Full name: Trần Thanh Tùng
Proctor 1 Proctor 2
Signature Signature

Full name: Full name:

STUDENT INFO
Student name:
Student ID:

INSTRUCTIONS: the total point is 100 (equivalent to 30% of the course)


1. Purpose:
• Test your knowledge on object-oriented programming in the following topics: Classes,
Objects, Encapsulation, Abstraction, Inheritance, and Polymorphism (CLO1)
• Examine your skill in analysis and design classes and algorithms (CLO2)
2. Requirement:
• Read carefully each question and answer it following the requirements

• SUBMIT YOUR EXAM TO THE BLACKBOARD


HCMC National University Student Name:………...……………………….
International University Student ID:…………………………….

1. (20 marks) In Object-Oriented Programming, describe, explain, and give an example to illustrate each
of the following keywords:
a. protected and private (10 marks)
b. super (10 marks)

2. (35 marks) Give the following code


public class A {
private int x;
public static int count1 = 0;
public int count2 = 0;

public A(int x) {
//TO IMPLEMENT

System.out.println("Ctor of A");
A.count1++;
count2++;
}
}
public class B extends A {
protected int y;
private int z;
public B (int x, int y, int z) {
// TO IMPLEMENT
System.out.println("Ctor of B");
}
}

a. (5 marks) Implement the constructor “public A (int x)”


b. (10 marks) Give examples to show the difference between count1 and count2
c. (5 marks) Implement a copy constructor for class A
d. (10 marks) Implement the constructor “public B (int x, int y, int z)”
e. (5 marks) What is the output after calling “B b = new B(1,2,3);”

3. (45 marks) A program to manage delivery services – MyDeli.


NOTE: Read the entire question before design and implement.

2 / 3
HCMC National University Student Name:………...……………………….
International University Student ID:…………………………….

In the system, there are drivers, clients, and services. Implement the system with the following
requirements
• Services. There are 3 types of services: food delivery, express delivery and in-day delivery. Each
service has a name and a price. A food delivery costs 1$ per km, an express delivery costs 2$ per
km, and in-day delivery costs 0.5$ per km. Each service has a status: booked, delivering, and
delivered.
• A driver can serve any type of service, but he can serve only one service at a time.
• A client can book many services and can check the status of all booked services.
• Each time a client books a service, the client must provide the distance for the delivery, and can
know the cost of the service but cannot select a driver.
• The system manages all booked service, and a driver can select and accept any booked service.
The status of the accepted service becomes delivering.
After finishing a delivery, the status of the service becomes delivered, 80% of cost of the service
goes to the account of the driver, and the driver is free to take another service.
a. (20 marks) Write classes to store services, clients, and drivers.
b. (15 marks) Implement a function name “MyDeli” to test the following scenario in order
1.Create 2 drivers (d1 and d2) and 2 clients (c1 and c2)
2.Client c1 books one 2km food delivery, one 5km express delivery.
3.Client c2 books one 10km express delivery.
4.Driver d1 accepts the food delivery
5.Show the status of all services of client c1
6.Driver d2 accepts the 5km express delivery, after finishing the service, accepts the 10km
express delivery.
7.Show the balance (account) of two drivers
8.Driver d1 finish all services, driver d2 finish all services
9.Show the status of all services of client c2
c. (10 marks) Implement the in-day delivery service where many booked in-day delivery services
can be grouped together and given to a driver. Write a function to test the scenario
o Client c1 books one 7km in-day delivery
o Client c2 books one 5km in-day delivery
o Combine 2 booking into a single service and give it to the driver d1.
o Show the balance of driver d1
-- The end --

3 / 3

You might also like