Updating record in random access file
Imports System Module m Sub main() Dim a, b, c as integer Console.writeline ("Enter 2 numbers") a= console.readline() b= console.readline() c= a * b If c.typeof() is integer then Console.writeline (c) Else Console.writeline (get type () ) End if 2.3 Write a program which counts Interest = Pnr/100 and show in ##.00 format and also count Total Amount by P (Pnr/100), show in ##, ###.00 format.
The File System Object model does not provide random file creation or access methods.
It is conceivable (and it sometimes happens) that a graphics file will be read and displayed by a program designed to process textual data.
The result is that no meaningful output occurs (probably) and this is to be expected.
Net Imports System Module m Public Class base Dim a As Integer Public Sub dis() My Class.printdata() End Sub Public Overridable Sub printdata() console.writeline("Base Class") End Sub End Class Public Class derive Inherits base Public Overloads Sub dis(By Val s As String) My Base.dis() console.writeline(s) End Sub Public Overrides Sub printdata() console.writeline("Derive Class") End Sub End Class Sub main() Dim d As New derive d.printdata() d.dis("By Derive Class method") End Sub End Module //some more programs about 10 more // 2.1 Write a program to give example of implicit and explicit type conversions.
The implicit program are shown as: Imports System Module m Sub main() Dim a, b As Integer Dim c As Double Console.writeline("Enter 2 integers") a = CInt(Console.readline()) b = CInt(console.readline()) c = a * b Console.
Writeline("Multiple : ", c) End Sub End Module The explicit conversion program is shown as: Imports System Module m Sub main() Dim a, b As Double Dim c As integer Console.writeline ("Enter 2 integers") a = CDbl (Console.readline()) b = CDbl (console.readline()) c = Cint (a / b) Console.
The bytes in random-access files form identical records, each containing one or more fields.
For example, the Worker Type defined below creates 19-byte records that consist of three fields: Before your application opens a file for random access, it should declare all variables required to handle data from the file.
This includes user-defined types, which correspond to records in the file, as well as standard types for other variables that hold data related to processing a file opened for random access.
The records in random-access file can be accessed directly and quickly without searching through a large number of records as in the case of sequential-access file.
Random-access file is used in instant access systems such as banking system, sale system, air-line reservation system, etc.
Before opening a file for random access, define a type that corresponds to the records the file does or will contain.