The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 103 Weeks Ago, 3 Days Ago |
| Questions Answered: | 4870 |
| Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
Assignment 9 Practical Arrays (Chapter 8)
Specification of program
This program may be used to explore the array structure and the ListBox component. The ListBox is used to present the values stored in an array. You are required to code the event handlers for the initialize array and the display array. A constant is used to allow for easy manipulation of the array. The arrays are declared as follows:
Â
private
{ Private declarations }
const
nItems = 5;
var
nBasicsIntArray : array [0..(nItems-1)] of integer;
nBasicsStrArray : array [0..(nItems-1)] of string;
public
{ Public declarations }
end;
Â
The following code is used in the OnShow of the form:
procedure Tfrm2016Assignment9.FormShow(Sender: TObject);
//as an alternative, you may experiment with TDateTimePicker
var
dDateTime : TDateTime;
begin
//set the date to the current date and time
dDateTime := Date() + Time();
edtDateTime.Text := DateTimeToStr(dDateTime);
edtDateTime.ReadOnly := TRUE;
end;
Â
The following EXAMPLE code is used to assign user values to the array:
procedure Tfrm2016Assignment9.btnAssignIntArrayClick(Sender: TObject);
var
iCount : Integer;
sString : String;
begin
for iCount := 0 to (nItems-1) do
begin
sString := InputBox('Please input an integer value', 'Value ' + IntToStr(iCount), '0');
nBasicsIntArray[iCount] := StrToInt(sString);
end;
end; INF1511/201
39
Â
Program structure – Initialize integer array, display double and display array.
Example of required output
This UI below presents the following (required) sequence of operations:
ï‚· Initialize STRING array to zero values.
ï‚· Assign STRING array. Values are assigned using the InputBox to gain user values.
ï‚· Display array.
ï‚· Convert strings to capital letters..
ï‚· Display array.
-----------