0% found this document useful (0 votes)
0 views2 pages

Lab 4 - OOP2

Uploaded by

truongdat531
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)
0 views2 pages

Lab 4 - OOP2

Uploaded by

truongdat531
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/ 2

Py - LAB - NLU

(Semester 1, 2024/2025)
Lab #4: OOP2
The main aim of the lab is to implement advanced OOP problems using Python
Programming Language.

=============================================================

Task 1. For a given class diagram as follows (Fig. 1):

Fig. 1. Class diagram 1

Implement the following methods:

1) demSoMon(int loai) in GiangVien class to count the courses that a lecturer can
teach with a given type
2) timGiangVienDayNhieuTinChiNhat() in Khoa class to find a lecturer who can
teach courses with the highest total number of credits.
3) thongKeMonHocTheoLoai() in Khoa class to statisticize courses by type, with key
being the type of a course and the value is a list of corresponding courses.
4) timMonHoc(String tenGiangVien, String loai) in Khoa class to filter courses
based on the lecturer’s name and course type. The results should be sorted by
the name of each course.

Task 2. For a given class diagram in the following figure (Fig. 2):

Implements the following methods in class Order:


1) Get all products belonging to a given category and their price values are
higher than a given threshold
2) Get all products based on a given category and decrease their price to 10%
3) Get the cheapest product in a given category
1
Py - LAB - NLU
(Semester 1, 2024/2025)
4) Get statistics of products by category (key = category, value = products)
5) Get the most expensive products by category (key = category, value = most
expensive product)

Fig. 2. Class diagram 2

Implements the following methods in the class OrderManager:


6) Get all orders having products with a given category
7) Get all products ordered by a customer with a tier of 2 from 01/2/2024 to
01/04/2024
8) Get 3 recent orders
9) Get all orders ordered on 15/03/2024
10) Cost of all orders in 2/2024
11) Average cost of all orders bought on 15/03/2024
12) Get statistics for each order and the number of products (key: oid, value: the
number of products in the corresponding order)
13) Get statistics of orders by customer (key: cid, value: list of orders bought by
the corresponding customer)
14) Get statistics of orders and their cost (key: oid, value: cost)

You might also like