Code for 9.4 task - There is 2 parts to this task, they will be seperated by a space:
Public Class Form1
Private Sub btnNewName_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNewName.Click
Dim Name, NewName As String
Name = txtname.Text
NewName = UpperCaseFirstLetter(Name)
lblNewName.Text = NewName
End Sub
End Class
TASK 2
Module Module1
Function UpperCaseFirstLetter(ByVal OldString As String) As String
Dim FirstLetter As Char
Dim NewString As String
FirstLetter = Char.ToUpper(OldString.Substring(0, 1))
Mid(OldString, 1, 1) = FirstLetter
NewString = OldString
Return NewString
End Function
End Module
Alex's Blog
Wednesday, 16 March 2011
9.3
Code for 9.3 task below:
Public Class Form1
Private Sub btnCalcInterest_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalcInterest.Click
Dim Interest, AmountInvested As Decimal
Dim RateOfInterest As Single
Dim Years As Short
AmountInvested = txtamountinvested.text
RateOfInterest = txtInterestRate.Text
Years = txtYears.Text
Interest = CalculateInterest(AmountInvested, RateOfInterest, Years)
lblinterestrate.Text = Format(Interest, "Currency")
End Sub
Function CalculateInterest(ByVal Principal As Decimal, ByVal InterestRate As Single, ByVal numberYears As Short) As Decimal
Dim Interest As Decimal
Dim Year As Short
Interest = 0
For Year = 1 To numberYears
Interest = Interest + ((Principal + Interest) * InterestRate / 100)
Next Year
Return Interest
CalculateInterest = Interest
End Function
End Class
Public Class Form1
Private Sub btnCalcInterest_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalcInterest.Click
Dim Interest, AmountInvested As Decimal
Dim RateOfInterest As Single
Dim Years As Short
AmountInvested = txtamountinvested.text
RateOfInterest = txtInterestRate.Text
Years = txtYears.Text
Interest = CalculateInterest(AmountInvested, RateOfInterest, Years)
lblinterestrate.Text = Format(Interest, "Currency")
End Sub
Function CalculateInterest(ByVal Principal As Decimal, ByVal InterestRate As Single, ByVal numberYears As Short) As Decimal
Dim Interest As Decimal
Dim Year As Short
Interest = 0
For Year = 1 To numberYears
Interest = Interest + ((Principal + Interest) * InterestRate / 100)
Next Year
Return Interest
CalculateInterest = Interest
End Function
End Class
9.2
Code below for the 9.2 task:
Option Strict On
Public Class Form1
Dim Total As Integer
Dim NumberOfMarks As Integer
Private Sub btnOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOK.Click
Dim Number As Integer
Number = CInt(txtMark.Text)
lstMarks.Items.Add(Number)
Call ProcessOneNumber(Number, Total, NumberOfMarks)
btnShowMean.Enabled = True
txtMark.Text = ""
txtMark.Focus()
End Sub
Private Sub btnShowMean_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnShowMean.Click
Dim Mean As Double
Call Calcmean(Total, NumberOfMarks, CSng(Mean))
txtMean.Text = CStr(Mean)
txtMean.Visible = True
lblMean.Visible = True
txtMark.Enabled = False
btnOK.Enabled = False
End Sub
Private Sub btnQuit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnQuit.Click
Me.Close()
End Sub
Private Sub txtMark_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtMark.TextChanged
btnOK.Enabled = True
End Sub
Sub ProcessOneNumber(ByVal ExamMark As Integer, ByRef MarksTotal As Integer, ByRef CountOfMarks As Integer)
MarksTotal = MarksTotal + ExamMark
CountOfMarks = CountOfMarks + 1
End Sub
Sub Calcmean(ByVal MarksTotal As Integer, ByVal CountOfMarks As Integer, ByRef Average As Single)
Average = CSng(MarksTotal / CountOfMarks)
End Sub
End Class
Option Strict On
Public Class Form1
Dim Total As Integer
Dim NumberOfMarks As Integer
Private Sub btnOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOK.Click
Dim Number As Integer
Number = CInt(txtMark.Text)
lstMarks.Items.Add(Number)
Call ProcessOneNumber(Number, Total, NumberOfMarks)
btnShowMean.Enabled = True
txtMark.Text = ""
txtMark.Focus()
End Sub
Private Sub btnShowMean_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnShowMean.Click
Dim Mean As Double
Call Calcmean(Total, NumberOfMarks, CSng(Mean))
txtMean.Text = CStr(Mean)
txtMean.Visible = True
lblMean.Visible = True
txtMark.Enabled = False
btnOK.Enabled = False
End Sub
Private Sub btnQuit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnQuit.Click
Me.Close()
End Sub
Private Sub txtMark_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtMark.TextChanged
btnOK.Enabled = True
End Sub
Sub ProcessOneNumber(ByVal ExamMark As Integer, ByRef MarksTotal As Integer, ByRef CountOfMarks As Integer)
MarksTotal = MarksTotal + ExamMark
CountOfMarks = CountOfMarks + 1
End Sub
Sub Calcmean(ByVal MarksTotal As Integer, ByVal CountOfMarks As Integer, ByRef Average As Single)
Average = CSng(MarksTotal / CountOfMarks)
End Sub
End Class
9.1
This is the VB code used to complete the task below:
Private Sub hsbRed_Scroll (...) Handles hsbRed.Scroll
Me.BackColor = ColorTranslator.FromO1e(RGB(hsbRed.Value, hsbGreen.Value, hsbBlue.Value.))
End Sub
Private Sub hsbGreen_Scroll (...) Handles hsbGreen.Scroll
Me.BackColor = ColorTranslator.FromO1e(RGB(hsbRed.Value, hsbGreen.Value, hsbBlue.Value.))
End Sub
Private Sub hsbBlue_Scroll (...) Handles hsbBlue.Scroll
Me.BackColor = ColorTranslator.FromO1e(RGB(hsbRed.Value, hsbGreen.Value, hsbBlue.Value.))
End Sub
---
Private Sub hsbBlue_scroll (ByVal sender As System. Object, ByVal e As System.Windows.For (...)
Call ShowFormColour( )
End Sub
Sub ShowFormColour( )
End Sub
End Class
---
Me.BackColor = ColorTranslator.FromO1e(RGB(hsbRed.Value, hsbGreen.Value, hsbBlue.Value))
---
Private Sub hsbRed_Scroll (...) Handles hsbRed.Scroll
Call ShowFormColour( )
End Sub
Private Sub hsbRed_Scroll (...) Handles hsbRed.Scroll
Call ShowFormColour( )
End Sub
Private Sub hsbRed_Scroll (...) Handles hsbRed.Scroll
Call ShowFormColour( )
End Sub
Private Sub hsbRed_Scroll (...) Handles hsbRed.Scroll
Me.BackColor = ColorTranslator.FromO1e(RGB(hsbRed.Value, hsbGreen.Value, hsbBlue.Value.))
End Sub
Private Sub hsbGreen_Scroll (...) Handles hsbGreen.Scroll
Me.BackColor = ColorTranslator.FromO1e(RGB(hsbRed.Value, hsbGreen.Value, hsbBlue.Value.))
End Sub
Private Sub hsbBlue_Scroll (...) Handles hsbBlue.Scroll
Me.BackColor = ColorTranslator.FromO1e(RGB(hsbRed.Value, hsbGreen.Value, hsbBlue.Value.))
End Sub
---
Private Sub hsbBlue_scroll (ByVal sender As System. Object, ByVal e As System.Windows.For (...)
Call ShowFormColour( )
End Sub
Sub ShowFormColour( )
End Sub
End Class
---
Me.BackColor = ColorTranslator.FromO1e(RGB(hsbRed.Value, hsbGreen.Value, hsbBlue.Value))
---
Private Sub hsbRed_Scroll (...) Handles hsbRed.Scroll
Call ShowFormColour( )
End Sub
Private Sub hsbRed_Scroll (...) Handles hsbRed.Scroll
Call ShowFormColour( )
End Sub
Private Sub hsbRed_Scroll (...) Handles hsbRed.Scroll
Call ShowFormColour( )
End Sub
Sunday, 13 March 2011
Sunday, 6 March 2011
System Software
Characteristics of different types of operating systems and their uses: batch, real-time, single-user, multi-user, multi-tasking and network systems.
- Batch: grouping data together and processing them at the same time. for example: printing bills, data is sent to the printer and when a certain number or a certain time is reached they are all processed together
- Real-time: there is continual input, processing and output as data is sent to be processed. For example, withdrawing money from your bank account and the money is deducted from your account balance straight away
- Single-user: It is an Operating System that is developed and intended for use on a machine that can only have a single user at anyone time. for example these can be found on home computers or other work environments.
- Multi-user: This is an OS that allows multiple users on different computers to access a single system with the same OS on it at the same time. This means it can receive multiple instructions at the same time and manage and process all of them. For example, a mainframe or a server is an example of multi-user OS. A server where or example multiple personal accounts send print jobs to a printer at the same time and then can manage and print all of the tasks told too.
Thursday, 3 March 2011
Purpose of Operating Systems
Operating System Purposes:
An operating system is the framework that allows you to communicate with computer hardware in an interactive way. Without this, you would not be able to tell the computer to do anything and it would have any instructions to follow. This is why it is important for a computer to have an operating system. In early days without OS so much problems where faced like accessing or getting output it takes two days. To make it much more efficient OS is used.

For large systems, the operating system has even greater responsibilities and powers. It is like a traffic cop -- it makes sure that different programs and users running at the same time do not interfere with each other. The operating system is also responsible for security, ensuring that unauthorized users do not access the system.
Operating systems can be classified as follows:
Operating systems provide a software platform on top of which other programs, called application programs, can run. The application programs must be written to run on top of a particular operating system. Your choice of operating system, therefore, determines to a great extent the applications you can run. For PCs, the most popular operating systems are DOS, OS/2, and Windows, but others are available, such as Linux.
As a user, you normally interact with the operating system through a set of commands. For example, the DOS operating system contains commands such as COPY and RENAME for copying files and changing the names of files, respectively. The commands are accepted and executed by a part of the operating system called the command processor or command line interpreter. Graphical user interfaces allow you to enter commands by pointing and clicking at objects that appear on the screen.
Subscribe to:
Posts (Atom)