Area of a Nut (Form Designer)

Grade 12

This is a form-based problem — open it in the Form Designer, not the code judge. An edit box (edtQ1_3) holds the width of a hexagonal nut, in cm, across its flats; a button (btnQ1_3) and a panel (pnlQ1_3) are already on the form. Write btnQ1_3's OnClick handler so that, given the flat-to-flat width d in edtQ1_3, it works out the nut's area (the hexagon minus the circular hole through its middle) and shows it on pnlQ1_3, rounded to one decimal place, formatted exactly like '45.3 cm squared'.

No input/output in the console sense. Grading sets edtQ1_3.Text to a width, clicks btnQ1_3 once, then checks pnlQ1_3.Caption. Formula: , where is the value in edtQ1_3. Examples: d = 5 -> '45.3 cm squared' d = 10 -> '181.3 cm squared'

Area of a Nut─ ▢ ✕
Width across flats, d (cm):
Calculate
Area:

5 components · drag to move, corner handle to resize, Delete to remove

Object Inspector

Select a component on the form to edit its properties.

Palette

Pick a component, then click the form

Standard

Additional

Data

Non-visual