Final Test (Online Version) Course: Object Oriented Programming
Final Test (Online Version) Course: Object Oriented Programming
- The time of the Question and answering session will be notified to you by
your theory lecturer.
III. Requirements
PART 1: GENERAL (4 points)
Question 1: Java (1 point)
a. Describe the rule of variable naming in Java and make some variable naming
examples.
b. Describe 03 of all the primitive types in Java.
c. Solve these requirements:
● Define a Calculator class.
● Define method public static boolean checkPrime(int n) to check if n is
prime or not. If yes, return true, else return false.
● Define method public static int calSumPrime(int n) to calculate the
sum of all prime numbers that are less than n.
● Define a main method to verify those methods.
Question 2: Class and object (1 point)
a. Define class Student with these requirements:
● Contain at least 03 properties (These properties must logically be
suitable for a student) with private access modifier.
● Contain at least 02 constructor.
● Contain getters/setters.
b. Define class Test and a main method to constructor objects of Student. Output
to the screen the properties of Student class with the help of getters.
Question & answering (2 points): The Question & answering content includes
knowledge about Java, class, object and student solution.
2
Ton Duc Thang University
Faculty of Information Technology
- Question 1 (0.5 points): Read the requirement and write a specification (Explain
properties, methods, inheritance, overload, override, … which are included in
your solution).
- Question 2 (0.5 points): Draw class diagram.
- Question 3 (1.0 point): Solution implementation for classes in the requirement.
- Question 4 (0.5 points): Write a book management class to manage an existing
book.
- Question 5 (0.5 points): Write a main method to test your solution. (Points will
be counted if the student implemented the correct class according to the
requirement).
- Question & answering session (3 points): Students will answer lecturer
questions about theory and your solution related to these 5 questions.
With part 2, students need to design properties and methods that are in accordance
with business requirements logically. Classes, properties, methods naming are not
specified in a strict way, the naming is of your choice but need to meet business
requirements properly.
For solution implementation (code) needs to be copied to the report.
Question 1 (0.5 points): Students write a specification about the subject Book store
management. One Book class and two classes that inherited from Book are Literary
Book and Magazine. Student self-implement properties, methods, 1 of those properties
need to be the book original cost, at least 02 random properties (suitable with a
book object), 02 random constructors, 01 abstraction method for selling price
calculation and another 02 process methods (Constructor, getter/setter, toString,
equals are not counted as process method).
For the literary book there must be at least 02 properties: Author and Publishing
year, another 02 constructors, 01 method for selling price calculation and 02
process methods. For the selling price calculation method, the formula is the original
cost + 5% tax.
For the magazine there must be at least 02 properties: Date of publishing and
Publisher, another 02 constructors, 01 method for selling price calculation and 02
process methods. For the selling price calculation method, the formula is the original
cost + 10% tax.
3
Ton Duc Thang University
Faculty of Information Technology
---THE END---