See voting results:
3. Use Case Name: Voting Results Actor(s):
User, Administrator.
Description:
The administrator can see the result of the voting.
Pre-conditioners:
The administrator has log-in to the system.
Post-conditioners:
No post-conditioners.
Priority:
High
Normal Course of Events:
o Administrator log-in to the online voting system.
Class Diagram:
A Class diagram describes the types of objects in the System and the various kinds of static relationships that exist among them.
Description: The classes used in this project are Online voting
New Registration
Voting Results
Participants Administrator Voting System Voting Results Database
Login
Login
Displaying Nominees verify
Vote for Nominees
Update
counting Votes Displaying results
Processing DB
Sequence Diagram:
A Sequence diagram depicts the sequence of actions that occur in a system. The invocation of methods in each object, and the order in which the invocation occurs is captured in a Sequence diagram. This makes the Sequence diagram a very useful tool to easily represent the dynamic behavior of a system.
A Sequence diagram is two-dimensional in nature. On the horizontal axis, it shows the life of the object that it represents, while on the vertical axis, it shows the sequence of the creation or invocation of these objects. Because it uses class name and object name references, the Sequence diagram is very useful in elaborating and detailing the dynamic design.
Description:
It depicts the high level sequence diagram for online voting. The various scenarios of the sequence diagram used in this project are
Participants Administrator Voting System Voting Results Database
Collaboration Diagram:
Description:
A Collaboration diagram is very similar to a Sequence diagram in the purpose it achieves; in other words, it shows the dynamic interaction of the objects in a system. A distinguishing feature of a Collaboration diagram is that it shows the objects and their association with other objects in the system apart from how they interact with each other. The association between objects is not represented in a Sequence diagram.
A Collaboration diagram is easily represented by modeling objects in a system and representing the associations between the objects as links. The interaction between the objects is denoted by arrows. To identify the sequence of invocation of these objects, a number is placed next to each of these arrows.
In this collaboration diagram, the objects are represented as rectangle, the actors are stick figures. Whereas the sequence diagram illustrates the object and actor interaction overtime, the collaboration diagram shows the object and actor interaction without reference to time.
State-transition Diagram:
The state transition diagram (STD) indicates how the system behaves as a consequence of external events. To accomplish this, the STD represents the various modes of behavior (called states) of the system and the manner in which transitions are made from state to state. The STD serves as the basis for behavioral modeling. A state transition diagram indicates how the system moves from state to state. The state transition diagram represents the behavior of a system by depicting its states and the events that cause the system to change state.
Description:
A state transition diagram indicates how the system moves from state to state.The state transition diagram represents the behavior of a system by depicting its states and the events that cause the system to change state. Start initiate Login Registration Enter details invalid complete Canceled cancel Counting Admin Voting Displaying Results Completed complete complete Participant
PROJECT IMPLEMENTATION:
Coding:
Form1:
Dim db As Database Dim rs As Recordset
Private Sub Command1_Click() Dim i
Dim n
n = rs.RecordCount rs.MoveFirst For i = 0 To n
If rs.EOF = True Then
MsgBox ("Invalid username and password, register your details") GoTo a
End If
If Text1.Text = rs("username") And Text2.Text = rs("voteid") Then Me.Hide Form3.Show Else rs.MoveNext End If a: Next End Sub
Private Sub Command2_Click() Me.Hide
Form2.Show End Sub
Private Sub Command3_Click() End
End Sub
Private Sub Command4_Click()
If Text1.Text = "administrator" And Text2.Text = "hcl123" Then Me.Hide
Form4.Show Else
MsgBox ("Access denied") End If
End Sub
Private Sub Form_Load()
Set db = OpenDatabase("d:\vbexp\exp5\login.mdb") Set rs = db.OpenRecordset("login")
Form2:
Dim db As Database Dim rs As Recordset
Private Sub Command1_Click() Dim i Dim n Dim f As Integer n = rs.RecordCount rs.MoveFirst For i = 0 To n If rs.EOF Then rs.AddNew rs("username") = Text1.Text rs("voteid") = Text2.Text rs("email") = Text3.Text rs("addr") = Text4.Text rs.Update
MsgBox ("updated successfully") GoTo a
End If
If Text1.Text = rs("username") Or Text2.Text = rs("voteid") Or Text3.Text = rs("email") Or Text4.Text = rs("addr") Then
MsgBox ("your details already updated") Else
rs.MoveNext End If
a: Next End Sub
Private Sub Command2_Click() End
End Sub
Private Sub Command3_Click() Text1.Text = ""
Text2.Text = "" Text3.Text = "" Text4.Text = "" End Sub
Private Sub Form_Load()
Set db = OpenDatabase("d:\vbexp\exp5\login.mdb") Set rs = db.OpenRecordset("login")
End Sub
Private Sub Label1_Click() End Sub
Private Sub Picture1_Click() Me.Hide
Form1.Show End Sub
Form3:
Dim db As Database Dim rs As Recordset
Private Sub Command1_Click() Dim f As Integer
If Option1.Value Then f = 1
ElseIf Option2.Value Then f = 2
ElseIf Option3.Value Then f = 3
ElseIf Option4.Value Then f = 4 End If Select Case (f) Case 1: rs.Edit rs("jeeva") = Val(rs("jeeva")) + 1 rs.Update Case 2: rs.Edit rs("surya") = Val(rs("surya")) + 1 rs.Update Case 3: rs.Edit
rs("karthi") = Val(rs("karthi")) + 1 rs.Update Case 4: rs.Edit rs("dhanush") = Val(rs("dhanush")) + 1 rs.Update End Select
MsgBox ("Thanks for voting") Me.Hide
Form1.Show End Sub
Private Sub Form_Load()
Set db = OpenDatabase("d:\vbexp\exp5\voting.mdb") Set rs = db.OpenRecordset("vote")
End Sub
Private Sub Picture1_Click() Me.Hide
Form1.Show End Sub
Form4:
Dim db As Database Dim rs As Recordset
Private Sub Command1_Click()
If (Val(rs("jeeva")) > Val(rs("surya")) And Val(rs("jeeva")) > Val(rs("karthi")) And Val(rs("jeeva")) > Val(rs("dhanush"))) Then
MsgBox ("jeeva is leading")
ElseIf (Val(rs("surya")) > Val(rs("jeeva")) And Val(rs("surya")) > Val(rs("karthi")) And Val(rs("surya")) > Val(rs("dhanush"))) Then
MsgBox ("Surya is leading")
ElseIf (Val(rs("karthi")) > Val(rs("surya")) And Val(rs("karthi")) > Val(rs("jeeva")) And Val(rs("karthi")) > Val(rs("dhanush"))) Then
MsgBox ("karthi is leading") Else
MsgBox ("dhanush is leading") End If
End Sub
Private Sub Form_Load()
Set db = OpenDatabase("d:\vbexp\exp5\voting.mdb") Set rs = db.OpenRecordset("vote")
End Sub
Private Sub Picture1_Click() Me.Hide
Form1.Show End Sub
RESULT:
Thus the Problem is analyzed, designed and implemented using Rational Rose/Visual Basic/MS Access. The Result of the project is evaluated by performing unit testing, Integration testing and