QUESTION 2 (Functions) (15 credits) You are required to design and write a program that converts a given rand amount to another currency. The three currency options are presented on the user interface as a collection of RadioButtons in a GroupBox. A conversion percentage of 2% is deduced.The program uses the event handlers below. --------------- procedure TfrmCurrencyCalculator.radEuroClick(Sender: TObject); begin edtCurrency.Text := ForeignCurrency(StrToFloat(edtRand.Text),0.1389); lblOtherCurrency.Caption := 'Euro'; end ; procedure TfrmCurrencyCalculator.radBritishClick(Sender: TObject); begin edtCurrency.Text := ForeignCurrency(StrToFloat(edtRand.Text),0.0873); lblOtherCurrency.Caption := 'British pound'; end ; procedure TfrmCurrencyCalculator.radAusDollarClick(Sender: TObject); begin edtCurrency.Text := ForeignCurrency(StrToFloat(edtRand.Text),0.2397); lblOtherCurrency.Caption := 'Australian dollar'; end; -------- 1. Why is the subroutine ForeignCurrency considered a function? 2. Write the code for the subroutine ForeignCurrency. (8) 3. What will the program do when a non-numeric value is entered into edtRand? (1) 4. Re-write the event handler TfrmCurrencyCalculator.radEuroClick to handle non-numeric values in the Rand Edit component by setting edtCurrency’s Text property to ‘0.00'. (4) *************** QUESTION 3 (Functions and RadioGroup) (20 credits) This currency conversion program is an upgrade of the one used in Question 2 of this assignment. The following changes are required. The currencies that could be considered for conversion are presented in a RadioGroup. In this example there are seven currencies available for The exchange rates are stored conversion. Exchange rates: in an array declared in the program. These must be entered prior to the conversion of any currency. Note that the exchange rate array must be initialized to zero in the FormShow. The array ExchangeRates is declared in accordance with the number of currencies considered. The declaration of the array for the exchange rates: ExchangeRates : array [0..6] of Double; The Enter button prompts for the exchange rate of the currency selected in the RadioGroup. The Show button displays all the currencies as well as the exchange rates (as per the array values). 1. Write the code for the FormShow event that initializes all the rates of exchange to zero. 2. Write the code for the btnEnterRates that saves the exchange rate of the selected currency. Note that this event must also clear the listing of the rates, as well as the lblConverted. 3. Write the code for the btnShowRates event, that lists the currencies and the exchange rates in the ListBox. The listbox should be cleared first though! 4. Write the code for the btnConvert that converts the amount in rand in the edit box, according to the currency selected in the RadioGroup and the exchange rate in the array. The result of the conversion must be displayed in the label lblConverted. 5. Write the code that will execute when the user selects a different currency. This must clear the message in lblConverted label.