Solutions to Exercises in Visual Basic .NET

Making QR Code 2d barcode in Visual Basic .NET Solutions to Exercises
Solutions to Exercises
QR Code Generator In VB.NET
Using Barcode printer for .NET Control to generate, create Denso QR Bar Code image in .NET framework applications.
Exercise 31
Make Bar Code In Visual Basic .NET
Using Barcode maker for .NET framework Control to generate, create bar code image in .NET framework applications.
Module Module1 Sub Main() Dim area, radius As Single radius = 875 area = 314 * radius * radius ConsoleWriteLine("Area is {0}", area) End Sub End Module
QR Generation In Visual C#
Using Barcode generator for Visual Studio .NET Control to generate, create QR Code image in VS .NET applications.
Exercise 32
QR-Code Generator In VS .NET
Using Barcode generator for ASP.NET Control to generate, create QR Code ISO/IEC18004 image in ASP.NET applications.
a) b) c) d) e) f) g) h)
QR Code Drawer In VS .NET
Using Barcode creator for .NET framework Control to generate, create QR Code image in .NET framework applications.
Dim ProgLang As String = "Visual Basic NET" Dim Xmas As Date = "25/12/03" Dim Attendance As Short Dim Attendance As Byte Dim Fuel As Single Dim Category As Char Dim EarthToMoonMiles As Integer Dim OrderTime As Date 'Stores Date and Time 'nb could be Integer 'nb could be Short/Integer 'nb could be Double
Bar Code Drawer In VB.NET
Using Barcode drawer for .NET framework Control to generate, create bar code image in VS .NET applications.
Exercise 33
Bar Code Printer In Visual Basic .NET
Using Barcode creator for VS .NET Control to generate, create bar code image in .NET framework applications.
a) Illegal (contains spaces) b) Illegal (contains hyphens, interpreted as minus signs) c) Legal (underscore is ok) d) Illegal (can not start with a digit) e) Illegal (decimal point/full stop not allowed) f) Legal g) Legal h) Legal i) Illegal (decimal point at start) j) Illegal (# not allowed)
Code 39 Generation In Visual Basic .NET
Using Barcode creator for .NET Control to generate, create Code-39 image in Visual Studio .NET applications.
3 n The Visual Basic NET Language
Painting Code 128B In Visual Basic .NET
Using Barcode creator for .NET framework Control to generate, create Code-128 image in .NET framework applications.
Exercise 34
Draw ECC200 In Visual Basic .NET
Using Barcode maker for VS .NET Control to generate, create ECC200 image in VS .NET applications.
0 3 01/01/0001 00:00:00 25/12/2003 00:00:00
Barcode Drawer In Java
Using Barcode generator for Java Control to generate, create barcode image in Java applications.
Exercises 35
Paint EAN-13 Supplement 5 In .NET Framework
Using Barcode generator for .NET framework Control to generate, create GS1 - 13 image in Visual Studio .NET applications.
1 a) b) c) d) e) f) g) h) i) j) k) l) n) 2 a) b) c) d) e) f) g) h) i)
Data Matrix ECC200 Reader In VS .NET
Using Barcode scanner for Visual Studio .NET Control to read, scan read, scan image in .NET applications.
H = N * 24 C = A Mod B (Mod operator gives remainder)
Generating Barcode In .NET
Using Barcode encoder for ASP.NET Control to generate, create barcode image in ASP.NET applications.
2 25 3 (an Integer the number of days) X (Char a single character) a (Char)
Code 39 Extended Creation In .NET
Using Barcode encoder for VS .NET Control to generate, create Code 39 image in VS .NET applications.
True (Boolean result of 4 = 2 comparison) False (Boolean result of 4 = 5 comparison)
UPC A Maker In .NET Framework
Using Barcode generator for .NET framework Control to generate, create UPC A image in VS .NET applications.
Welcome Alistair 21 (an Integer) 8 (an Integer)
Generate EAN-13 Supplement 5 In Java
Using Barcode generator for Java Control to generate, create EAN-13 image in Java applications.
(a String)
Draw Bar Code In Visual C#.NET
Using Barcode generation for .NET framework Control to generate, create bar code image in .NET applications.
1100 (a Single or Double) Hello Linda
Code 128 Reader In .NET Framework
Using Barcode decoder for Visual Studio .NET Control to read, scan read, scan image in VS .NET applications.
False (Boolean result of an And expression where one of the operands is False (Not HasConviction))
Recognize EAN13 In Visual Studio .NET
Using Barcode scanner for .NET Control to read, scan read, scan image in .NET framework applications.
m) False (Boolean result of negating (25 >= 21))
Price = Price + Price * 15 / 100, or Price *= 115 X *= X AdultTicket = (Age >= 21) MortgageRemaining -= PaymentsMade C = 2 * 314 * R N = (N1 + N2 + N3) / 3 H = Sqrt( X * X + Y * Y )
Exercise 36
a = ReadLine() b = ReadLine() c = ReadLine() WriteLine((a + b + c)/3)
Solutions to Exercises
Write("Enter your name: ") name = ReadLine() Write("Enter your address: ") addr = ReadLine() Write("Enter your telephone number: ") tel = ReadLine() WriteLine(tel) WriteLine(addr) WriteLine(name)
Write("Enter the length of the box") Length = ReadLine() Write("Enter the width of the box") Width = ReadLine() Write("Enter the height of the box") Height = ReadLine() Volume = Length * Width * Height WriteLine("Volume is {0}", Volume)
Exercises 37
1 a)
Structure Person Name As String Address As String DateOfBirth As Date NumberOfChildren As Byte 'Could be Short or Integer End Structure
Structure Car EngineSize As Short 'Allows up to 32Litres NumberOfDoors As Byte RegistrationDate As Date LicenceNumber As String 'Contains letters End Structure
Structure CD Title As String Artist As String DistributionLabel As String IssueYear As Short NumberOfTracks As Short End Structure
3 n The Visual Basic NET Language
Structure MapReference Longitude As String 'Needed for notation eg 10 15'W Latitude As String 'Needed for notation eg 51 28'N End Structure
Structure WindowSettings Left As Short Top As Short Width As Short Height As Short End Structure
Dim P As Person = ("Fred Bloggs", "1 High St", _ "12/07/1970", 4) Dim C As Car = (1600, 4, "11/02/2002", "SB51 GGX") Dim Album As CD = ("The Old Kit Bag", "Richard Thompson", _ "Cooking Vinyl", 2003) Dim Greenwich As MapReference = ("0 0'W", "51 28'N") Dim WinPos As WindowSettings = (200, 50, 400, 250)
Exercises 38
Enum Months January = 1 February March April May June July August September October November December End Enum
Enum BodyStyle TwoDoor = 2 ThreeDoor = 3 FourDoor = 4 FiveDoor = 5 End Enum
Answers to Review Questions
Answers to Review Questions
1 The range of built-in data types and classes in NET programs is de ned in: a) The Common Language Runtime
b) MSIL c) The Common Type System Correct
d) Visual Basic 2 The numeric data type that stores numbers to the highest available precision is: a) c)
Integer Decimal Correct
b) Double d) Long 3 An identi er is: a) c) The name given to a variable, structure, enumeration or code block Correct A value that uniquely identi es an operation to be performed b) Line of program code that Identi es some result d) A tool in Visual Studio for displaying the names of features 4 Distinguish between a structure and an enumeration A structure is a de nition of a package of variables as a type An enumeration is a de nition of a range of integer values, giving each a name that describes what the integer represents 5 An expression can be part of a statement or A statement can be part of an expression Which is correct An expression can be part of a statement 6 A structure, WageRecord, is de ned as shown below:
Structure WageRecord Dim NormalHoursWorked As Integer Dim PayRate As Decimal Dim OverTimeHours As Integer Dim OverTimeRate As Decimal Dim Expenses As Decimal End Structure
A workers wage is calculated by multiplying NormalHoursWorked by PayRate, adding the multiplication of OverTimeHours by OverTimeRate, and adding Expenses Given a variable of type WageRecord had been declared with the identi er Pay and has had values assigned to it, write one or more statements that will assign the resulting pay to a variable Wage What would be the most suitable type for this variable
Dim Wage As Decimal Wage = PayNormalHoursWorked * PayPayRate + _ PayOverTimeHours * PayOverTimeRate + PayExpenses