Oefeningen P 29

You might also like

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 3

Option Compare Database Public Sub tickets()

'oefening 5
Dim intAantal As Integer
Public Sub OmtrekCirkel() Dim sngPrijs As Single
'oefening 1 Dim intAantalGratis As Integer
Dim sngStraal As Single intAantal = InputBox("geef het
Dim sngOmtrek As Single aantal tickets door")
sngStraal = InputBox("geef de straal sngPrijs = intAantal * 1.25
in", "invoer") intAantalGratis =int( intAantal / 10)
sngOpp = 2 * sngStraal * 3.14 MsgBox "de prijs is: " & sngPrijs &
MsgBox "de oppervlakte is: " & " voor " & intAantal & " ticketten, je
sngOmtrek, vbInformation, "uitvoer" krijgt er ook " & intAantalGratis & "
End Sub gratis bij", vbInformation, "uitvoer"
End Sub
_________________________
______________________
Public Sub direct()
'oefening 2 Public Sub SomEnVerschil()
Dim intPrijs As Integer 'oefening 6
Dim sngPrijsMetKorting As Single Dim intSom As Integer
Const csteKorting = 0.05 Dim intVerschil As Integer
intPrijs = InputBox("geef de prijs Dim intGetal1 As Integer
in", "invoer") Dim intGetal2 As Integer
sngPrijsMetKorting = intPrijs * (1 - intGetal1 = InputBox("geef een getal
csteKorting) in", "invoer")
Debug.Print "het bedrag met korting er intGetal2 = InputBox("geef een getal
af bedraagt: " & sngPrijsMetKorting in", "invoer")
End Sub intSom = intGetal1 + intGetal2
intVerschil = intGetal1 - intGetal2
_____________________________ MsgBox "De som is: " & intSom &
vbCrLf & "Het verschil is: " &
Public Sub waarschuwing() intVerschil, vbInformation, "uivoer"
'oefening 3 End Sub
Dim strWaarschuwing As String
strWaarschuwing = InputBox("geef ____________________________
de waarschuwing in", "invoer")
MsgBox strWaarschuwing,
vbExclamation, "uitvoer"
End Sub

______________________
Public Function hoofdletters() Public Function Letters(strTekst As String)
'oefening 7 As String
Dim strTekst As String Dim intLengte As Integer
Dim strHoofdletters As String Dim strKarakter As String
strTekst = InputBox("geef een zin Dim strNieuweTekst As String
Dim intTeller As Integer
in", "invoer")
strNieuweTekst = ""
strHoofdletters = UCase(strTekst) intLengte = Len(strTekst)
MsgBox strHoofdletters, For intTeller = 1 To intLengte
vbInformation, "uitvoer" strKarakter = Mid(strTekst, intTeller, 1)
End Function If strKarakter = "o" Then
strKarakter = "s" + strKarakter + "s"
_________________________ strNieuweTekst = strNieuweTekst +
strKarakter
Public Function OppervlakteCirkel() Else
'oefening 8 If strKarakter = "a" Then
Dim sngStraal As Single strKarakter = "s" + strKarakter + "s"
Dim sngOppervlakte As Single Else
strKarakter = strKarakter
sngStraal = InputBox("geef een cijfer
End If
in, de standaardwaarde = 7", "invoer", strNieuweTekst = strNieuweTekst +
7) strKarakter
sngOppervlakte = sngStraal * End If
sngStraal * 3.14 Next
MsgBox "de straal = " & Debug.Print strNieuweTekst
sngOppervlakte, vbExclamation, End Function
"invoer" __________________________________
End Function
Public Sub Datum()
___________________________ Dim strDag As String
Dim intDag As Integer
Dim dteDatum As Date
Public Function DagVanDeWeek()
Dim intKwartaal As Integer
'oefening 9 dteDatum = InputBox("geef een datum
Dim dteGeboorteDatum As Date in", "invoer")
Dim intCijfer As Integer intDag = Weekday(dteDatum)
Dim strWeekdag As String strDag = WeekdayName(intDag, False,
dteGeboorteDatum = InputBox("geef vbSunday)
de geboortedatum in", "invoer") Select Case True
intCijfer = Case Month(dteDatum) = 1 To 3
Weekday(dteGeboorteDatum) intKwartaal = 1
strWeekdag = Case Month(dteDatum) = 4 To 6
WeekdayName(intCijfer) intKwartaal = 2
MsgBox "de dag waarop je geboren Case Month(dteDatum) = 7 To 9
intKwartaal = 3
bent is: " & strWeekdag, vbInformation,
Case Month(dteDatum) = 10 To 12
"uitvoer" intKwartaal = 4
End Function End Select
MsgBox "De dag is: " & strDag & " en het
kwartaal is: " & intKwartaal,
vbExclamation, "uitvoer"
End Sub

You might also like