Final Exam CPL - Practice.t102
Final Exam CPL - Practice.t102
T ra in in g Ex am s
Version 1.0
Hanoi, Nov/2019
C++ Programming Language Issue/Revision: 1.1
RECORD OF CHANGES
Contents
Problem 01: Type of Triangle ................................................................................................ 5
Specifications: ................................................................................................................... 5
Task: ................................................................................................................................. 5
Problem 02: Cutting a Round Cake ....................................................................................... 6
Specifications: ................................................................................................................... 6
Task: ..................................................................................................................................... 6
Problem 03: Friend number................................................................................................... 7
Specifications: ................................................................................................................... 7
Task: ................................................................................................................................. 7
Problem 04: Manage Employees .......................................................................................... 7
Specifications: ................................................................................................................... 7
Task 01: Create Abtract Class Emloyees .......................................................................... 7
Task 02: Create class Developer inherits class Emloyees ................................................. 8
Task 03: Create class Manager inherits class Emloyees ................................................... 8
CODE: CPL.Practice.T102
TYPE: Long
LOC:
DURATION: 180 MINUTES
Types of triangle:
1. Not a Triangle
2. Normal
3. Right
4. Isosceles
5. Right-Isosceles
6. Equilateral
Input: Three points with coordinates (x, y) is positive integers present by an array of six
elements.
-1000 <= x, y <= 1000.
Output: Type of triangle (a string)
Example:
Input: {0, 0, 0, 3, 4, 0}
Output: Right Triangle
Task:
- Create project name CPL.Practice.T102.Problem01
- Create method with signature typeOfTriangle(float
threePointsCoordinates[]) and points input by keyboard.
- Write code inside the method to resolve Problem 01.
- Add comments to explain your code.
We have a round cake (circular) and problem is how to slice the cake with n straight lines.
Calculate the maximum number of pieces the cake can have. See the image with case of 1,
2, 3 slices below for more details:
Output: The maximum number of pieces the sliced cake can have.
Example:
Task:
- Create project name CPL.Practice.T102.Problem02
- Create method with signature int cakeCutting(int n), with n enter input by
keyboard.
- Write code inside the method to resolve Problem 02.
- Add comments to explain your code.
a is called friend of b if: if the sum of the divisors of a is equal to b and vice versa.
Output: Print ‘true’ if two integers are friend and ‘false’ otherwise.
Example:
Task:
- Create project name CPL.Practice.T102.Problem03
- Create method with signature bool friendNumber (int a, int b), with a and b enter
input by keyboard.
- Write code inside the method to resolve Problem 03.
- Add comments to explain your code.
As a developer of FPT software, you are requested to create app to manager employees.
Task common:
- Create project name: CPL.Practice.T102.Problem04
- Add comments to explain your code.
- Create a Abtract Class named Employees (at least 6 empoyees) with infomation :
account (Ex: VanNC), name, department (Ex: FA.G0) , job title (Developer, Tester, Manager)
- In class Manager add more infomation : Customer’s name (Ex: Donald Trump)
--------------------------------------------------------END-----------------------------------------------------------