Module Module1
Sub Main()
Dim num1 As Integer
Dim num2 As Integer
Dim num3 As Integer
num1 = 0
num2 = 1
For i = 0 To 40
num3 = num1 + num2
Console.WriteLine(i & ") " & num1 & " + " & num2 & " = " & num3)
num1 = num2
num2 = num3
Next
Console.ReadLine()
End Sub
End Module
computer science
Monday, 30 January 2017
Tuesday, 17 January 2017
revision from test
Why should floating point numbers be stored in normalised form?
Less risk of rounding errors.
State two advantages of using a normalised representation.
It is more precise for the given number of bits.
A larger mantissa allows for a greater range of numbers.
A smaller exponent is less accurate.
Less risk of rounding errors.
State two advantages of using a normalised representation.
It is more precise for the given number of bits.
A larger mantissa allows for a greater range of numbers.
A smaller exponent is less accurate.
Sunday, 1 January 2017
Saturday, 31 December 2016
Tuesday, 27 December 2016
basic code for game
Module Module1
Dim age As Single
Dim Name As String
Dim Helth As Single
Dim THealth As Single
Dim RHealth As Single
Sub Main()
Dim NameLoop As Boolean
Dim NameCheck As String
THealth = 100
Helth = 100
RHealth = 100
NameLoop = True
While NameLoop = True
Console.WriteLine("please enter your name")
Name = Console.ReadLine()
Console.WriteLine("are you sure you want this name: Y/N")
NameCheck = Console.ReadLine()
If NameCheck = "Y" Or NameCheck = "y" Then
NameLoop = False
ElseIf NameCheck = "N" Or NameCheck = "n" Then
NameLoop = True
Else
Console.WriteLine("that is invalid")
NameLoop = True
End If
End While
protocal1()
Dim age As Single
Dim gender As String
Console.ReadLine()
End Sub
Sub protocal1()
Console.WriteLine("you are in a city, skyscrapers dominate the land and airships dominate the sky")
Console.WriteLine("there are flying adverts for everything from robot dogs to the most 'reaistic' apples in the world")
Dim move1 As Single
Dim move1loop As Boolean
Console.WriteLine("a droid flies over to you")
Console.WriteLine("- hello my name is barry welcome to Jorvic - the droid spoke in an unettelingly human voice")
Console.WriteLine("the droid flies away ")
Console.WriteLine(" ")
Console.WriteLine(" you have three options of where to go first ")
Console.WriteLine("1) the person closest to you")
Console.WriteLine("2) the officers club")
Console.WriteLine("3) ministry of location")
Console.WriteLine("you can either choose 1, 2 or 3")
Dim caseloop1 As Boolean
caseloop1 = True
While caseloop1 = True
move1loop = True
While move1loop = True
Try
move1 = Console.ReadLine()
move1loop = False
Catch ex As Exception
Console.WriteLine("that is invalid please try again")
move1loop = True
End Try
Select Case move1
Case "1"
Console.WriteLine("the person neerest to you is a man of aveage hight with a skull cap and goggles on")
Console.WriteLine("you ask him about what you are to do in this new place")
Console.WriteLine(" ")
Console.WriteLine("- well if you are a new arrival you should go to the ministry of location - he spoke in a quick and erratic mannor")
Console.WriteLine(" ")
Console.WriteLine("you ask him what that is")
Console.WriteLine(" ")
Console.WriteLine("- well as the name suggests they locate or re-locate people to where they are needed -")
Console.WriteLine("- I am sorry but I have to go, good luck at the ministry. -")
Console.WriteLine(" ")
Console.WriteLine("the man runs off and you wonder what to do next")
caseloop1 = True
Case "2"
Console.WriteLine("you walk into a club")
Console.WriteLine("the room was empty")
Console.WriteLine("the lights were off exept for over the bar")
Console.WriteLine("you walk over and call out for somebody")
Console.WriteLine("a few seconds later a tall thin man with long black hair on one side of his head and th other shaven comes out form a door behind the bar")
Console.WriteLine(" ")
Console.WriteLine("- sorry but we arn't open yet - he spokein a calm almost dead tone")
Console.WriteLine(" ")
Console.WriteLine("you tell him that you just want to know where to go and you tell him what has happened")
Console.WriteLine(" ")
Console.WriteLine("- my name is ben, I run this club with my sister bernedette, if you don't have a job and don't know what to do you should go to the ministry of location -")
Console.WriteLine("- but be warned you may not like where you are placed - ")
Console.WriteLine(" ")
Console.WriteLine("you go back to your origonal location")
caseloop1 = True
Case "3"
Console.WriteLine("you walk up to a large intimidating building with a large stone statue of Eudaemon outside")
Console.WriteLine("inside the building is covered in various types of marble")
Console.WriteLine("you see a woman sat behind a desk wearing smart clothes on a computer")
Console.WriteLine("you go up to the woman and ask what if this is the minastry of location")
Console.WriteLine(" ")
Console.WriteLine("- yes you are at the ministry of location - she spoke in a polite and formal manor")
Console.WriteLine("- before you can continue you have to fill out these questions")
Console.WriteLine("she hands you a questionair")
Console.WriteLine("you write your name at the top and continue to answer the questions")
Console.WriteLine(" ")
Dim ageloop As Boolean
ageloop = True
While ageloop = True
Console.WriteLine("what is your age")
Try
age = Console.ReadLine()
ageloop = False
Catch ex As Exception
Console.WriteLine("that is invalid try again")
ageloop = True
End Try
End While
Dim gender As Char
Dim genloop As Boolean
genloop = True
While genloop = True
Console.WriteLine("what is your gender M/F")
Dim genloop2 As Boolean
genloop2 = True
While genloop2 = True
Try
gender = Console.ReadLine()
genloop2 = False
Catch ex As Exception
Console.WriteLine("that is invalid, please try again")
genloop2 = True
End Try
End While
If gender = "M" Or gender = "m" Then
genloop = False
ElseIf gender = "F" Or gender = "f" Then
genloop = False
Else
Console.WriteLine("your answer must be F or M and nothing else, try again")
genloop = True
End If
End While
End Select
End While
Dim exit1 As Char
Dim exitloop As Boolean
Dim exitloop2 As Boolean
exitloop = True
While exitloop = True
exitloop2 = True
While exitloop2 = True
Console.WriteLine("are you sure about your choices Y/N")
Try
exit1 = Console.ReadLine()
exitloop2 = False
Catch ex As Exception
Console.WriteLine("that is invalid")
exitloop2 = True
End Try
End While
If exit1 = "Y" Or exit1 = "y" Then
exitloop = False
caseloop1 = False
ElseIf exit1 = "N" Or exit1 = "n" Then
exitloop = False
caseloop1 = True
End If
End While
End While
End Sub
End Module
Dim age As Single
Dim Name As String
Dim Helth As Single
Dim THealth As Single
Dim RHealth As Single
Sub Main()
Dim NameLoop As Boolean
Dim NameCheck As String
THealth = 100
Helth = 100
RHealth = 100
NameLoop = True
While NameLoop = True
Console.WriteLine("please enter your name")
Name = Console.ReadLine()
Console.WriteLine("are you sure you want this name: Y/N")
NameCheck = Console.ReadLine()
If NameCheck = "Y" Or NameCheck = "y" Then
NameLoop = False
ElseIf NameCheck = "N" Or NameCheck = "n" Then
NameLoop = True
Else
Console.WriteLine("that is invalid")
NameLoop = True
End If
End While
protocal1()
Dim age As Single
Dim gender As String
Console.ReadLine()
End Sub
Sub protocal1()
Console.WriteLine("you are in a city, skyscrapers dominate the land and airships dominate the sky")
Console.WriteLine("there are flying adverts for everything from robot dogs to the most 'reaistic' apples in the world")
Dim move1 As Single
Dim move1loop As Boolean
Console.WriteLine("a droid flies over to you")
Console.WriteLine("- hello my name is barry welcome to Jorvic - the droid spoke in an unettelingly human voice")
Console.WriteLine("the droid flies away ")
Console.WriteLine(" ")
Console.WriteLine(" you have three options of where to go first ")
Console.WriteLine("1) the person closest to you")
Console.WriteLine("2) the officers club")
Console.WriteLine("3) ministry of location")
Console.WriteLine("you can either choose 1, 2 or 3")
Dim caseloop1 As Boolean
caseloop1 = True
While caseloop1 = True
move1loop = True
While move1loop = True
Try
move1 = Console.ReadLine()
move1loop = False
Catch ex As Exception
Console.WriteLine("that is invalid please try again")
move1loop = True
End Try
Select Case move1
Case "1"
Console.WriteLine("the person neerest to you is a man of aveage hight with a skull cap and goggles on")
Console.WriteLine("you ask him about what you are to do in this new place")
Console.WriteLine(" ")
Console.WriteLine("- well if you are a new arrival you should go to the ministry of location - he spoke in a quick and erratic mannor")
Console.WriteLine(" ")
Console.WriteLine("you ask him what that is")
Console.WriteLine(" ")
Console.WriteLine("- well as the name suggests they locate or re-locate people to where they are needed -")
Console.WriteLine("- I am sorry but I have to go, good luck at the ministry. -")
Console.WriteLine(" ")
Console.WriteLine("the man runs off and you wonder what to do next")
caseloop1 = True
Case "2"
Console.WriteLine("you walk into a club")
Console.WriteLine("the room was empty")
Console.WriteLine("the lights were off exept for over the bar")
Console.WriteLine("you walk over and call out for somebody")
Console.WriteLine("a few seconds later a tall thin man with long black hair on one side of his head and th other shaven comes out form a door behind the bar")
Console.WriteLine(" ")
Console.WriteLine("- sorry but we arn't open yet - he spokein a calm almost dead tone")
Console.WriteLine(" ")
Console.WriteLine("you tell him that you just want to know where to go and you tell him what has happened")
Console.WriteLine(" ")
Console.WriteLine("- my name is ben, I run this club with my sister bernedette, if you don't have a job and don't know what to do you should go to the ministry of location -")
Console.WriteLine("- but be warned you may not like where you are placed - ")
Console.WriteLine(" ")
Console.WriteLine("you go back to your origonal location")
caseloop1 = True
Case "3"
Console.WriteLine("you walk up to a large intimidating building with a large stone statue of Eudaemon outside")
Console.WriteLine("inside the building is covered in various types of marble")
Console.WriteLine("you see a woman sat behind a desk wearing smart clothes on a computer")
Console.WriteLine("you go up to the woman and ask what if this is the minastry of location")
Console.WriteLine(" ")
Console.WriteLine("- yes you are at the ministry of location - she spoke in a polite and formal manor")
Console.WriteLine("- before you can continue you have to fill out these questions")
Console.WriteLine("she hands you a questionair")
Console.WriteLine("you write your name at the top and continue to answer the questions")
Console.WriteLine(" ")
Dim ageloop As Boolean
ageloop = True
While ageloop = True
Console.WriteLine("what is your age")
Try
age = Console.ReadLine()
ageloop = False
Catch ex As Exception
Console.WriteLine("that is invalid try again")
ageloop = True
End Try
End While
Dim gender As Char
Dim genloop As Boolean
genloop = True
While genloop = True
Console.WriteLine("what is your gender M/F")
Dim genloop2 As Boolean
genloop2 = True
While genloop2 = True
Try
gender = Console.ReadLine()
genloop2 = False
Catch ex As Exception
Console.WriteLine("that is invalid, please try again")
genloop2 = True
End Try
End While
If gender = "M" Or gender = "m" Then
genloop = False
ElseIf gender = "F" Or gender = "f" Then
genloop = False
Else
Console.WriteLine("your answer must be F or M and nothing else, try again")
genloop = True
End If
End While
End Select
End While
Dim exit1 As Char
Dim exitloop As Boolean
Dim exitloop2 As Boolean
exitloop = True
While exitloop = True
exitloop2 = True
While exitloop2 = True
Console.WriteLine("are you sure about your choices Y/N")
Try
exit1 = Console.ReadLine()
exitloop2 = False
Catch ex As Exception
Console.WriteLine("that is invalid")
exitloop2 = True
End Try
End While
If exit1 = "Y" Or exit1 = "y" Then
exitloop = False
caseloop1 = False
ElseIf exit1 = "N" Or exit1 = "n" Then
exitloop = False
caseloop1 = True
End If
End While
End While
End Sub
End Module
Sunday, 13 November 2016
Q1 (b) (ii)
in a 265colour image, each byte can represent 256 different colour codes
2 squared = 256 and there are 8 bits in a byte
2 squared = 256 and there are 8 bits in a byte
Q1 (a) (iii)
in this question I forgot to mention the staircase/ pixilation effect after a bitmap image is enlarged
Subscribe to:
Posts (Atom)