Monday, May 3, 2010

Learning & Assessment Activity 2.3

1. Create a new Visual Studio project and call it LA_Activity_2.3

2. Arrange controls on Form 1 as per the requirements of your algorithm from activity 1.1

3. Convert the algorithm you created in activity 1.1 to sequential code using Visual Basic.NET. (Ignore the input validation part for now)

4. Publish a screen shot of your code plus a description to your Chapter 2 assessment document










Let me explain my code(above)to you.

The first three lines of code (Dim) declare my variables that will be used in my algorithm.

In this case the variables will store the data type:decimal.

The next two lines of code (example :decParcelWeight = TextParcelWeight.Text) will assign the inputs from the Text Boxes to each of the variables in turn.

The input gathered by a Text Box is treated as a String data type,this is done by default.
For this reason conversion functions have been used in the two lines to convert the default string into the data type of decimal.

The next line determines the cost of the parcel by performing a multiplication operation(Parcel Weight x Standard Cost) using the(*)operator.

The result is then displayed to the user in a message box and the algorithm is complete.
When the program is executed this is the result:

No comments:

Post a Comment