☰ Contents · Computing

The RadioGroup

Lessons 53–54 · 2 lessons · N. I. Taylaqov (general editor), A. B. Akhmedov, M. D. Pardayeva, A. A. Abdug‘aniyev, U. M. Mirsanov. Informatics and Information Technologies, Grade 10, 1st edition. “Extremum-Press”, Tashkent, 2017
54

Practical lesson

Textbook: pp. 120–121
GoalBuilds a mini-test and a payment-type application with a RadioGroup, checks the answer with ItemIndex and counts the score.
New words
number of the correct answer: the ItemIndex that matches the right option · to‘g‘ri javob raqamiscore: the number of correct answers · balldiscount: a part of the price that is not paid · chegirmapercent: a hundredth part · foiz
Explanation

In the practical lesson two applications are created. 1) “Mini-test”: three RadioGroups, in each of which one of four answer options is correct. When the button is pressed s := 0; if RadioGroup1.ItemIndex = 1 then s := s + 1; … and at the end Label1.Caption := 'Ball: ' + IntToStr(s) + ' / 3'; appears. Invent the questions yourself and write the number of the correct answer in your notebook before checking it in the program. 2) “Payment type”: the RadioGroup has Cash (0), Card (1), Transfer (2); a 5% discount is given for cash: if the price is 200000, s := 200000 * 95 div 100 (integer division). In shopping and payment applications do not ask for or save real card numbers or passwords: this is only a learning model.

Worked examples
Questions: 1) 2+3*4 = ? (20, 14, 24, 12) – correct ItemIndex = 1; 2) 15 mod 4 = ? (0, 1, 2, 3) – correct ItemIndex = 3; 3) Length('Delphi') = ? (5, 6, 7, 8) – correct ItemIndex = 1. If the user chooses 1, 3, 0, the first two are correct: Ball: 2 / 3.
The price is 200000 and the payment is cash: 200000 * 95 div 100 = 190000; the discount is 10000. With a card or a transfer the price does not change: 200000. If the price is 120000, with cash 120000 * 95 div 100 = 114000.
Class activity

“Test makers”: each pair writes 3 invented questions; another pair tests them in the application and checks the score for two sets of answers calculated in advance.

Practice
1
What is the value of 2+3*4?
2
What is 15 mod 4?
3
The price is 150000, cash payment with a 5% discount. How much is paid?
4
Why should the number of the correct answer be written in the notebook first in the mini-test?