[go: up one dir, main page]

0% found this document useful (0 votes)
14 views16 pages

Computer Science Paper 3

The document outlines various programming tasks including checking if a number is odd or even, determining leap years, identifying prime numbers, and calculating age for driver's license eligibility using Visual Basic. It also includes sections on creating a database for cars and designing web pages for an organic products company, detailing HTML code for a home page, products page, and about us page. Each section provides code snippets and descriptions for the functionalities and interfaces involved.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views16 pages

Computer Science Paper 3

The document outlines various programming tasks including checking if a number is odd or even, determining leap years, identifying prime numbers, and calculating age for driver's license eligibility using Visual Basic. It also includes sections on creating a database for cars and designing web pages for an organic products company, detailing HTML code for a home page, products page, and about us page. Each section provides code snippets and descriptions for the functionalities and interfaces involved.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 16

1a) Developing a program that checks if a number is odd or even

The Code
Public Class Form1

Private Sub Button1_Click(sender As Object, e As EventArgs)


Handles Button1.Click
Dim number As Double
number = TextBox1.Text
If number Mod 2 = 0 Then
MsgBox(number & " is an even number")
Else
MsgBox(number & " is an odd number")

End If
End Sub
End Class

The Interface
2a) Developing a program to determine the leap year
Public Class Form1

Private Sub Button1_Click(sender As Object, e As


EventArgs) Handles Button1.Click
Dim year As Integer = TextBox1.Text
If year Mod 400 = 0 Then
MsgBox(year & " is a leap year")
Else
MsgBox(year & " is not a leap year")
End If
End Sub
End Class

The Interface
Question 3
a) The Code
Public Class Form1

Private Sub Button1_Click(sender As Object, e As EventArgs)


Handles Button1.Click
Dim number As Integer = TextBox1.Text
If number / number = 1 And number Mod 1 = 0 Then
MsgBox(number & " is a prime number")

ElseIf number Mod 2 Or 3 Or 4 Or 5 = 0 Then


MsgBox(number & " is not a prime number")
End If

End Sub

End Class

b)The interface
Question 4
a)The code
Public Class Form1

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles


Button1.Click
Dim birthyear As Date = DateTimePicker1.Value
Dim today As Date = Date.Today
Dim age As Integer = today.Year - birthyear.Year
If age >= 16 Then
MsgBox("You are " & age & " years old which means you are
legally legible to obtain a driver's license")
Else
MsgBox("You are " & age & " years old which means you are not
legally legible to obtain a driver's license")
End If

End Sub
End Class

b) The interface
SECTION B: DATABASE

Question 5
a) A database called CarsDb

b) Creating table tCar


c) Records

d) Report named All Cars


e) Query

f) Ascending Order
g) Deleting the record with CarID A004

SECTION C: WEB DESIGNING

Page 1 : Home Page


The Code
<!doctype html>
<html>
<head>
<title>Home Page</title>
</head>
<body>
<p><h1>Eco-Fresh Organics</h1></p>
<p>Our Mission statement:</p>
<p> Eco-Fresh Organics is dedicated to promoting sustainable living and
providing high-quality organic
<br> products to support healthy lifestyles and a greener planet </p>
<img src="nen.jpg">
<p><a href="products.html">Products<a/></p>
<p><a href="about.html">About Us<a/></p>
</body>
</html>
The page

Page 2: Products Page

The code
<!doctype html>
<html>
<head>
<title>Products Page</title>
</head>
<body>
<p><h1>Eco-Fresh Organics</h1></p>
<p>We offer a variety of fruits and vegetable for an affordable price</p>
<table border="10">
<th>Product Name</th>
<th>Description</th>
<th>Price($)</th>
<tr>
<td>Apple</td>
<td>A juicy red fruit</td>
<td>0.25</td>
</tr>
<tr>
<td>Rape</td>
<td>Vegetable</td>
<td>0.50</td>
</tr>
<tr>
<td>Pineapple</td>
<td>Fruit</td>
<td>1.25</td>
</tr>
<tr>
<td>Watermelon</td>
<td>Fruit</td>
<td>2.25</td>
</tr>
<tr>
<td>Cucumber</td>
<td>Vegetable</td>
<td>0.30</td>
</tr>
</table>
<img src="nun.png">
<p><a href="about.html">About Us<a/></p>
<p><a href="index.html">Home<a/></p>
</body>
</html>

THE PAGE
PAGE 3: About Us Page
<!doctype html>
<html>
<head>
<title>About Us Page</title>
</head>
<body>
<p><h1>Eco-Fresh Organics</h1></p>
<p>The company's headquarters are in Chinhoyi but we do have branches
all<br> over our country</p>
<p>Below are a number of ways to contact us</p>
<ul>
<li>You can call on our toll free telephone 0890965672</li>
<li>You can call the manager's office on 0717656789</li>
<li>You can also contact through email at
<email>ecofreshOrganicas@gmail.com</email></li>
<li>You can visit us at our headquaters at 1245 Orange Groove,
Chinhoyi </li>
</ul>
<img src="non.png">
<p><a href="products.html">Products<a/></p>
<p><a href="index.html">Home<a/></p>
</body>
</html>

The PAGE

You might also like