លំហាត់​អនុវត្តន៍

សំណួរ

១. តើ​យុទ្ធសាស្ត្រ​នៃ​ការសរសេរ​កម្មវិធី​កំព្យូទ័រ​តាម​របៀប PP (Prcedural Programming) និងតាម​របៀប OOP (Object Oriented Programming) ខុស​គ្នា​ដូចម្តេច​ដែរ?
២. តើ​ការបង្កើត​ថ្នាក់​មាន​ប្រយោជន៍​អ្វី​ខ្លះ​នៅ​ក្នុង​ការ​សរសេរ​កម្មវិធី​កំព្យូទ័រ?
៣. តើ​ក្បួន​និង​វិធី​ខុស​គ្នា​ដូចម្តេច​ដែរ?
៤. ​តើ​ធ្វើ​ដូចម្តេច​ទើប​អាច​យក​វិធី​ទាំងឡាយ​នៅ​ក្នុង​ថ្នាក់​ណាមួយ​មក​ប្រើ​បាន​?
៥. ​តើ​ពាក្យ​ថា «this» នៅ​ក្នុង​វិធី​ទាំងឡាយ​គឺ​ជា​អ្វី​ដែរ​?
៦. អ្វី​ទៅ​ជា​ទិន្នន័យ​សិស្ស?
៧. នៅ​ពេល​ដែល​យើង​យក​វិធី​ឬ​ទិន្នន័យ​ណា​មួយ​មក​ប្រើ​តាម​រយៈ​សិស្ស​ណា​មួយ តើ​ការស្វែង​រក​វត្ថុ​ឬ​អថេរ​នោះ​ត្រូវ​ធ្វើ​ឡើង​យ៉ាង​ដូច​ម្តេច​?

លំហាត់​អនុវត្តន៍

Task 1

Implement a class that describes a circle. The class should have the following components:

  1. field storing radius of the circle;
  2. get property that returns radius of the circle;
  3. set property that sets radius of the circle;
  4. get property that returns diameter of the circle;
  5. method that calculates area of the circle;
  6. method that calculates perimeter of the circle.

Demonstrate the work of properties and methods.

Task 2

Implement a class that describes the news (title, text, tag array, publication date). In the class, implement one print method that outputs all the information as follows:

Notice how date is displayed:
  1. if less than a day has passed since the publication date, then "today" is output;
  2. if less than a week has passed since the publication date, then "N days ago"
  3. in other cases, full date is output as follows: "dd.mm.yyyy"
Task 3

ក្នុង​ការយក​អក្សរ​ខ្មែរ​ពី​ប្រព័ន្ធ Google Fonts មក​ប្រើប្រាស់​នៅ​លើ​គេហទំព័រ​ណាមួយ យើង​ត្រូវ​សរសេរកូដ HTML ដូច​ខាង​ក្រោម​នេះ៖

<!DOCTYPE html>
<html>
  <head>
    <link href='https://fonts.googleapis.com/css?family=Odor+Mean+Chey' rel='stylesheet'>
  </head>
  <body style="font:14px/1.5 'Odor Mean Chey'">
  
    <p>កម្មវិធី​កាលបរិច្ឆេទ និង នាឡិកា Digital ជា​ភាសា​ខ្មែរ</p>
    
  </body>
</html>

នៅ​លើ​ទំព័រ HTML ខាង​លើ​នេះ យើង​ចាំបាច់​ត្រូវ​បង្កើត​និងបង្ហាញ​កាលបរិច្ឆេទ​នៅ​​ពេល​បច្ចុប្បន្ន និង​នាឡិកា digital មួយ​ជា​ភាសា​ខ្មែរ ដោយ​បង្កើត​ថ្នាក់​មួយ​ដែល​នៅ​ក្នុង​នោះ ត្រូវ​មាន​ទិន្នន័យ​និង​វិធី​ ចាំបាច់​ទាំងឡាយ​សំរាប់​បង្ហាញ​នូវ​កាលបរិច្ឆេទ និង​នាឡិកា digital ជា​ភាសា​ខ្មែរ​ ដូច​នៅ​លើ​ក្បាល​នៃ​គេហទំព័រ​ខាង​ក្រោម​នេះ៖
https://khtv.herokuapp.com/