0% found this document useful (0 votes)
185 views8 pages

Final Exam CPL - Practice.t102

This document contains instructions for a C++ programming exam. It includes 4 problems to solve involving type of triangles, cutting round cakes, checking if two numbers are friend numbers, and creating classes to manage employee data. For each problem, specifications are provided along with example inputs and outputs. Tasks are outlined for setting up projects and classes to solve each problem, with requirements to add comments and follow coding conventions. The document provides a coding framework and tests candidates' object-oriented C++ skills.

Uploaded by

Quang Vu
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)
185 views8 pages

Final Exam CPL - Practice.t102

This document contains instructions for a C++ programming exam. It includes 4 problems to solve involving type of triangles, cutting round cakes, checking if two numbers are friend numbers, and creating classes to manage employee data. For each problem, specifications are provided along with example inputs and outputs. Tasks are outlined for setting up projects and classes to solve each problem, with requirements to add comments and follow coding conventions. The document provides a coding framework and tests candidates' object-oriented C++ skills.

Uploaded by

Quang Vu
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/ 8

C++ Programming Language

T ra in in g Ex am s

Document Code 25e-BM/HR/HDCV/FSOFT

Version 1.0

Effective Date 22/11/2019

Hanoi, Nov/2019
C++ Programming Language Issue/Revision: 1.1

RECORD OF CHANGES

No Effective Date Change Description Reason Reviewer Approver

1 22/Nov/2019 Create new exam Create VanNC

25e-BM/HR/HDCV/FSOFT v1.1 Internal use 2/8


C++ Programming Language Issue/Revision: 1.1

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

25e-BM/HR/HDCV/FSOFT v1.1 Internal use 3/8


C++ Programming Language Issue/Revision: 1.1

CODE: CPL.Practice.T102
TYPE: Long
LOC:
DURATION: 180 MINUTES

Requirement 1: Working tools and Delivery requirements

• Working tools: Code::Block 20.02


• Delivery: Source code and test results in a compressed archive.
Requirement 2: Technologies

The product illustrates:


• Implement requirements by using C/C++ Programming Language, OOP within
common build-in classes, interfaces
• Implement user interaction with console
Requirement 3: Technical Requirements

• Use Object-Oriented programming style.


• Follow the standard naming and coding convention.
• Add appropriate comments for each class, method, attribute, …
• Create a folder named CPL.Practice.T102.
• Create a new project for each problem (all project in folder above) and the appropriate
class/interface
Mark scale:

• Problem 01: 2 marks;


• Problem 02: 2 marks;
• Problem 03: 2 marks;
• Problem 04: 4 marks;
o Task 01: 1 mark
o Task 02: 1 marks
o Task 03: 2 marks

25e-BM/HR/HDCV/FSOFT v1.1 Internal use 4/8


C++ Programming Language Issue/Revision: 1.1

Problem 01: Type of Triangle


Specifications:
Given three points in two dimensional space: A(x1, y1), B(x2, y2), C(x3, y3), check if we can
build a triangle or not. If ABC is a triangle, show type of ABC.

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.

25e-BM/HR/HDCV/FSOFT v1.1 Internal use 5/8


C++ Programming Language Issue/Revision: 1.1

Problem 02: Cut a Round Cake


Specifications:

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:

Input: Integer n (0 <= n <= 100).

Output: The maximum number of pieces the sliced cake can have.

Example:

For n=1, the output should be cakeCutting(n) = 2.

For n=2, the output should be cakeCutting(n) = 4.

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.

25e-BM/HR/HDCV/FSOFT v1.1 Internal use 6/8


C++ Programming Language Issue/Revision: 1.1

Problem 03: Friend number


Specifications:
Give two positive integers a and b, check a and b are friend or not.

a is called friend of b if: if the sum of the divisors of a is equal to b and vice versa.

Input: Two integers a and b (1 <= a, b <= 10000).

Output: Print ‘true’ if two integers are friend and ‘false’ otherwise.

Example:

For 220 and 284:

We have sum of divisors of 220 is 1+2+4+5+10+11+20+22+44+55+110=284 and sum of divisors


of 284 is 1+2+4+71+142=220. So they are friend.

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.

Problem 04: Manage Employees


Specifications:

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.

Task 01: Create Abtract Class Emloyees

- 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)

- Create methods: ShowInformation() to show all info of employees and


DisplayDailyWork() = 0;
- Add comments to explain your code.

25e-BM/HR/HDCV/FSOFT v1.1 Internal use 7/8


C++ Programming Language Issue/Revision: 1.1

Task 02: Create class Developer inherits class Emloyees

- In class Developer add more infomation : Project name (Ex: Printers_Hitachi)

- Create method: ShowInformation() to show to show all info of employees + project


name.

- Implement method DisplayDailyWork(), in this show up “Coding in project: [project


name]”
- Add comments to explain your code.

Task 03: Create class Manager inherits class Emloyees

- In class Manager add more infomation : Customer’s name (Ex: Donald Trump)

- Create method: ShowInformation() to show to show all info of employees +


customer’s name.

- Implement method DisplayDailyWork(), in this show up “Working with customer:


[customer’s name]”.
- Add comments to explain your code.

--------------------------------------------------------END-----------------------------------------------------------

25e-BM/HR/HDCV/FSOFT v1.1 Internal use 8/8

You might also like