ASSIGNMENT QUESTION
1) A local library has developed a “school holiday reading program” to encourage children to read more books during the holidays with prizes for earning a certain number of points. The first three books read are worth 9 points each, the next three books are worth 15 points each and all books over six are worth 20 points each. The prize for a score over 70 wins a reading badge and for 150 points or more is a mystery gift prize.
a) Formulate flowchart AND pseudo code algorithms to solve the problem mentioned above. The program will basically require the user to input the child’s name and the number of books read, and it will calculate and display the number of points earned. If the child has won a prize that information will also be displayed, along with their points earned and the number of points needed to win.
b) Develop an interface for this program.
===========================my answer============================
2.0 Methods of implementation.
a) Formulate flowchart AND pseudo code algorithms to solve the problem mentioned above. The program will basically require the user to input the child’s name and the number of books read, and it will calculate and display the number of points earned. If the child has won a prize that information will also be displayed, along with their points earned and the number of points needed to win.
b) Develop an interface for this program.
===========================my answer============================
1.0 Flowchart
Input
|
Process
|
Output
|
1. Child
Name
2. Number
of Books Read
|
Calculate
Points earned
|
1. Show points earned
2. Show prize
|
3.0 Formula
If Number of books read with 3 or less than 3 = 9
x Number of Books read
|
If
Number of books read
is greater than 3 and less than or
equal to 6 = 15xNumber of
Books read
|
If
Number of books read is greater than 6 = 20xNumber
of Books read
|
4.0 Pseudo Code
MULA (START)
INPUT
child Name
INPUT
Number of Books read
IF
Number of Books read <= 3 THEN
SET points = 9*Number of Books read
IF
Number of Books read > 3 AND Number of Books read <= 6 THEN
SET points = 15*Number of Books read
IF
Number of Books read > 6 THEN
SET points = 20*Number of Books read
ENDIF
IF
points >70 AND points <150 THEN
SET prize = “Reading Badge”
IF
points >= 150
SET prize = “Mystery Gift”
ELSE
SET prize = “None”
ENDIF
PRINT
points
PRINT
prize
TAMAT
(END)
5.0 Program
source code.
Private Sub
Command1_Click()
If Not IsNumeric(IBook.Text) Then
MsgBox ("Number of books read : Please
Enter numbers only...")
Else
If IBook.Text <= 3 Then
OPoint.Text = IBook.Text * 9
End If
If IBook.Text > 3 And IBook.Text
<= 6 Then
OPoint.Text = IBook.Text * 15
End If
If IBook.Text > 6 Then
OPoint.Text = IBook.Text * 20
End If
If OPoint.Text < 70 Then
OText.Text = "Sorry...No prize
will be given..."
End If
If OPoint.Text > 70 And points <
150 Then
OText.Text = "Your prize :
Reading Badge - Your point is over 70"
End If
If OPoint.Text > 150 Then
OText.Text = "Congratulation!
Collect Your Mystery Gift Now!"
End If
End If
End Sub
Private Sub
Command2_Click()
IBook.Text =
""
IName.Text =
""
End Sub
Private Sub
Command3_Click()
End
End Sub
6.0 Interface
design
7.0 Object Names, Properties Name and
Properties Value.
Object
Names
|
Properties
Name
|
Properties
Value
|
Label1
|
Caption
|
Enter Your Name :
|
IName
|
Text
|
|
Label2
|
Caption
|
Number of Books Read :
|
IBook
|
Text
|
|
CommandButton
|
Caption
Name
|
CALCULATE POINT
Command1
|
CommandButton
|
Caption
Name
|
RESET
Command2
|
Label3
|
Caption
|
OUTPUT
|
Label4
|
Caption
|
Your Point :
|
OPoint
|
Text
|
|
OText
|
Text
|
|
CommandButton
|
Caption
Name
|
EXIT
Command3
|