Skip to content

Commit ffbfab9

Browse files
authoredAug 3, 2023
Merge pull request larymak#292 from Adv-Software-Eng-Assessment/main
UML diagram
2 parents 51fec15 + 677df6e commit ffbfab9

14 files changed

+415
-0
lines changed
 

‎GAMES/Software-Eng-UI-Quiz/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Quiz Game
2+
Python based program for a quiz game using tkinter for graphical interface using object-oriented paradigm.
3+
4+
Unit tests written in quiz_tests.py
Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
<mxfile host="65bd71144e">
2+
<diagram id="m0LpNAFOlXJJz2TB_48-" name="Page-1">
3+
<mxGraphModel dx="377" dy="265" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0">
4+
<root>
5+
<mxCell id="0"/>
6+
<mxCell id="1" parent="0"/>
7+
<mxCell id="16" value="&lt;table border=&quot;1&quot; width=&quot;100%&quot; height=&quot;100%&quot; cellpadding=&quot;4&quot; style=&quot;width:100%;height:100%;border-collapse:collapse;&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;th align=&quot;center&quot;&gt;Quiz&lt;/th&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;-Answer:string&lt;br&gt;-Score:string&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;+ask_question()&lt;br&gt;+get_score()&lt;br&gt;+validate_question_one()&lt;br&gt;+validate_question_two()&lt;br&gt;+validate_question_three()&lt;br&gt;+validate_question_four()&lt;br&gt;+evaluate()&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;" style="text;html=1;whiteSpace=wrap;strokeColor=#FFFFFF;fillColor=#000000;overflow=fill;shadow=0;" parent="1" vertex="1">
8+
<mxGeometry x="300" y="150" width="160" height="210" as="geometry"/>
9+
</mxCell>
10+
<mxCell id="19" value="" style="endArrow=none;html=1;" parent="1" edge="1">
11+
<mxGeometry width="50" height="50" relative="1" as="geometry">
12+
<mxPoint x="300" y="180" as="sourcePoint"/>
13+
<mxPoint x="460" y="180" as="targetPoint"/>
14+
</mxGeometry>
15+
</mxCell>
16+
<mxCell id="20" value="" style="endArrow=none;html=1;" parent="1" edge="1">
17+
<mxGeometry width="50" height="50" relative="1" as="geometry">
18+
<mxPoint x="300" y="240" as="sourcePoint"/>
19+
<mxPoint x="460" y="240" as="targetPoint"/>
20+
</mxGeometry>
21+
</mxCell>
22+
<mxCell id="TqZz6jEH2jH0oDJbgpl6-20" value="Class Diagram&lt;br&gt;" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;fontSize=18;" parent="1" vertex="1">
23+
<mxGeometry x="290" y="110" width="140" height="40" as="geometry"/>
24+
</mxCell>
25+
</root>
26+
</mxGraphModel>
27+
</diagram>
28+
<diagram id="3uIdc4k1AIia2OYn3mmE" name="Page-2">
29+
<mxGraphModel dx="792" dy="556" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0">
30+
<root>
31+
<mxCell id="0"/>
32+
<mxCell id="1" parent="0"/>
33+
<mxCell id="PwaJlgn1apJX0QR0KZld-1" value="" style="ellipse;shape=doubleEllipse;whiteSpace=wrap;html=1;shadow=0;strokeColor=#FFFFFF;fillColor=#000000;" parent="1" vertex="1">
34+
<mxGeometry x="360" y="40" width="100" height="60" as="geometry"/>
35+
</mxCell>
36+
<mxCell id="PwaJlgn1apJX0QR0KZld-2" value="start" style="text;strokeColor=none;fillColor=none;html=1;fontSize=24;fontStyle=1;verticalAlign=middle;align=center;shadow=0;" parent="1" vertex="1">
37+
<mxGeometry x="450" y="40" width="100" height="40" as="geometry"/>
38+
</mxCell>
39+
<mxCell id="PwaJlgn1apJX0QR0KZld-3" value="" style="html=1;whiteSpace=wrap;aspect=fixed;shape=isoRectangle;shadow=0;strokeColor=#FFFFFF;fillColor=#000000;" parent="1" vertex="1">
40+
<mxGeometry x="300" y="150" width="200" height="120" as="geometry"/>
41+
</mxCell>
42+
<mxCell id="PwaJlgn1apJX0QR0KZld-4" value="&lt;font style=&quot;font-size: 14px;&quot;&gt;user ready to play game&lt;/font&gt;" style="text;strokeColor=none;fillColor=none;html=1;fontSize=24;fontStyle=1;verticalAlign=middle;align=center;shadow=0;" parent="1" vertex="1">
43+
<mxGeometry x="350" y="190" width="100" height="40" as="geometry"/>
44+
</mxCell>
45+
<mxCell id="PwaJlgn1apJX0QR0KZld-5" value="" style="endArrow=classic;html=1;fontSize=14;exitX=0.4;exitY=1;exitDx=0;exitDy=0;exitPerimeter=0;" parent="1" source="PwaJlgn1apJX0QR0KZld-1" target="PwaJlgn1apJX0QR0KZld-3" edge="1">
46+
<mxGeometry width="50" height="50" relative="1" as="geometry">
47+
<mxPoint x="400" y="400" as="sourcePoint"/>
48+
<mxPoint x="450" y="350" as="targetPoint"/>
49+
</mxGeometry>
50+
</mxCell>
51+
<mxCell id="PwaJlgn1apJX0QR0KZld-6" value="" style="endArrow=classic;html=1;fontSize=14;exitX=1.005;exitY=0.525;exitDx=0;exitDy=0;exitPerimeter=0;" parent="1" source="PwaJlgn1apJX0QR0KZld-3" target="PwaJlgn1apJX0QR0KZld-2" edge="1">
52+
<mxGeometry width="50" height="50" relative="1" as="geometry">
53+
<mxPoint x="400" y="400" as="sourcePoint"/>
54+
<mxPoint x="510" y="120" as="targetPoint"/>
55+
<Array as="points">
56+
<mxPoint x="520" y="210"/>
57+
<mxPoint x="520" y="80"/>
58+
<mxPoint x="460" y="80"/>
59+
</Array>
60+
</mxGeometry>
61+
</mxCell>
62+
<mxCell id="PwaJlgn1apJX0QR0KZld-7" value="" style="rounded=1;whiteSpace=wrap;html=1;shadow=0;strokeColor=#FFFFFF;fontSize=14;fillColor=#000000;" parent="1" vertex="1">
63+
<mxGeometry x="280" y="310" width="240" height="60" as="geometry"/>
64+
</mxCell>
65+
<mxCell id="PwaJlgn1apJX0QR0KZld-8" value="&lt;font style=&quot;font-size: 18px;&quot;&gt;user select answer&lt;/font&gt;" style="text;strokeColor=none;fillColor=none;html=1;fontSize=24;fontStyle=1;verticalAlign=middle;align=center;shadow=0;" parent="1" vertex="1">
66+
<mxGeometry x="360" y="320" width="100" height="40" as="geometry"/>
67+
</mxCell>
68+
<mxCell id="PwaJlgn1apJX0QR0KZld-9" value="" style="endArrow=classic;html=1;fontSize=14;exitX=0.5;exitY=1.017;exitDx=0;exitDy=0;exitPerimeter=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="1" source="PwaJlgn1apJX0QR0KZld-3" target="PwaJlgn1apJX0QR0KZld-7" edge="1">
69+
<mxGeometry width="50" height="50" relative="1" as="geometry">
70+
<mxPoint x="400" y="400" as="sourcePoint"/>
71+
<mxPoint x="450" y="350" as="targetPoint"/>
72+
</mxGeometry>
73+
</mxCell>
74+
<mxCell id="PwaJlgn1apJX0QR0KZld-10" value="no" style="text;strokeColor=none;fillColor=none;html=1;fontSize=24;fontStyle=1;verticalAlign=middle;align=center;shadow=0;" parent="1" vertex="1">
75+
<mxGeometry x="490" y="160" width="100" height="40" as="geometry"/>
76+
</mxCell>
77+
<mxCell id="PwaJlgn1apJX0QR0KZld-14" value="yes" style="text;strokeColor=none;fillColor=none;html=1;fontSize=24;fontStyle=1;verticalAlign=middle;align=center;shadow=0;" parent="1" vertex="1">
78+
<mxGeometry x="320" y="260" width="100" height="40" as="geometry"/>
79+
</mxCell>
80+
<mxCell id="PwaJlgn1apJX0QR0KZld-15" value="" style="rounded=0;whiteSpace=wrap;html=1;shadow=0;strokeColor=#FFFFFF;fontSize=14;fillColor=#000000;" parent="1" vertex="1">
81+
<mxGeometry x="280" y="395" width="240" height="50" as="geometry"/>
82+
</mxCell>
83+
<mxCell id="PwaJlgn1apJX0QR0KZld-16" value="&lt;font style=&quot;font-size: 18px;&quot;&gt;Program validate answer&lt;/font&gt;" style="text;strokeColor=none;fillColor=none;html=1;fontSize=24;fontStyle=1;verticalAlign=middle;align=center;shadow=0;" parent="1" vertex="1">
84+
<mxGeometry x="360" y="400" width="100" height="40" as="geometry"/>
85+
</mxCell>
86+
<mxCell id="PwaJlgn1apJX0QR0KZld-18" value="" style="endArrow=classic;html=1;fontSize=18;exitX=0.5;exitY=1;exitDx=0;exitDy=0;" parent="1" source="PwaJlgn1apJX0QR0KZld-7" edge="1">
87+
<mxGeometry width="50" height="50" relative="1" as="geometry">
88+
<mxPoint x="400" y="400" as="sourcePoint"/>
89+
<mxPoint x="400" y="390" as="targetPoint"/>
90+
</mxGeometry>
91+
</mxCell>
92+
<mxCell id="PwaJlgn1apJX0QR0KZld-19" value="" style="html=1;whiteSpace=wrap;aspect=fixed;shape=isoRectangle;shadow=0;strokeColor=#FFFFFF;fontSize=18;fillColor=#000000;" parent="1" vertex="1">
93+
<mxGeometry x="280" y="470" width="240" height="144" as="geometry"/>
94+
</mxCell>
95+
<mxCell id="PwaJlgn1apJX0QR0KZld-20" value="&lt;font style=&quot;font-size: 14px;&quot;&gt;Has user click submit button&lt;/font&gt;" style="text;strokeColor=none;fillColor=none;html=1;fontSize=24;fontStyle=1;verticalAlign=middle;align=center;shadow=0;" parent="1" vertex="1">
96+
<mxGeometry x="350" y="522" width="100" height="40" as="geometry"/>
97+
</mxCell>
98+
<mxCell id="PwaJlgn1apJX0QR0KZld-24" value="" style="endArrow=classic;html=1;fontSize=14;entryX=0.5;entryY=0;entryDx=0;entryDy=0;entryPerimeter=0;" parent="1" target="PwaJlgn1apJX0QR0KZld-19" edge="1">
99+
<mxGeometry width="50" height="50" relative="1" as="geometry">
100+
<mxPoint x="400" y="450" as="sourcePoint"/>
101+
<mxPoint x="450" y="350" as="targetPoint"/>
102+
</mxGeometry>
103+
</mxCell>
104+
<mxCell id="PwaJlgn1apJX0QR0KZld-25" value="" style="endArrow=classic;html=1;fontSize=14;exitX=1;exitY=0.486;exitDx=0;exitDy=0;exitPerimeter=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="PwaJlgn1apJX0QR0KZld-19" target="PwaJlgn1apJX0QR0KZld-7" edge="1">
105+
<mxGeometry width="50" height="50" relative="1" as="geometry">
106+
<mxPoint x="560" y="530" as="sourcePoint"/>
107+
<mxPoint x="560" y="340" as="targetPoint"/>
108+
<Array as="points">
109+
<mxPoint x="560" y="540"/>
110+
<mxPoint x="560" y="340"/>
111+
</Array>
112+
</mxGeometry>
113+
</mxCell>
114+
<mxCell id="PwaJlgn1apJX0QR0KZld-26" value="" style="shape=ext;double=1;rounded=0;whiteSpace=wrap;html=1;shadow=0;strokeColor=#FFFFFF;fontSize=14;fillColor=#000000;" parent="1" vertex="1">
115+
<mxGeometry x="265" y="640" width="270" height="50" as="geometry"/>
116+
</mxCell>
117+
<mxCell id="PwaJlgn1apJX0QR0KZld-27" value="&lt;font style=&quot;font-size: 18px;&quot;&gt;Program calculate score&lt;/font&gt;" style="text;strokeColor=none;fillColor=none;html=1;fontSize=24;fontStyle=1;verticalAlign=middle;align=center;shadow=0;" parent="1" vertex="1">
118+
<mxGeometry x="350" y="650" width="100" height="40" as="geometry"/>
119+
</mxCell>
120+
<mxCell id="PwaJlgn1apJX0QR0KZld-28" value="" style="endArrow=classic;html=1;fontSize=18;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="1" target="PwaJlgn1apJX0QR0KZld-26" edge="1">
121+
<mxGeometry width="50" height="50" relative="1" as="geometry">
122+
<mxPoint x="400" y="612" as="sourcePoint"/>
123+
<mxPoint x="450" y="562" as="targetPoint"/>
124+
</mxGeometry>
125+
</mxCell>
126+
<mxCell id="PwaJlgn1apJX0QR0KZld-29" value="" style="rounded=0;whiteSpace=wrap;html=1;shadow=0;strokeColor=#FFFFFF;fontSize=18;fillColor=#000000;" parent="1" vertex="1">
127+
<mxGeometry x="270" y="720" width="260" height="50" as="geometry"/>
128+
</mxCell>
129+
<mxCell id="PwaJlgn1apJX0QR0KZld-30" value="Display score" style="text;strokeColor=none;fillColor=none;html=1;fontSize=24;fontStyle=1;verticalAlign=middle;align=center;shadow=0;" parent="1" vertex="1">
130+
<mxGeometry x="350" y="725" width="100" height="40" as="geometry"/>
131+
</mxCell>
132+
<mxCell id="PwaJlgn1apJX0QR0KZld-31" value="" style="endArrow=classic;html=1;fontSize=18;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="1" source="PwaJlgn1apJX0QR0KZld-27" target="PwaJlgn1apJX0QR0KZld-29" edge="1">
133+
<mxGeometry width="50" height="50" relative="1" as="geometry">
134+
<mxPoint x="400" y="600" as="sourcePoint"/>
135+
<mxPoint x="450" y="550" as="targetPoint"/>
136+
</mxGeometry>
137+
</mxCell>
138+
<mxCell id="PwaJlgn1apJX0QR0KZld-32" value="no" style="text;strokeColor=none;fillColor=none;html=1;fontSize=24;fontStyle=1;verticalAlign=middle;align=center;shadow=0;" parent="1" vertex="1">
139+
<mxGeometry x="550" y="470" width="100" height="40" as="geometry"/>
140+
</mxCell>
141+
<mxCell id="PwaJlgn1apJX0QR0KZld-33" value="yes" style="text;strokeColor=none;fillColor=none;html=1;fontSize=24;fontStyle=1;verticalAlign=middle;align=center;shadow=0;" parent="1" vertex="1">
142+
<mxGeometry x="270" y="590" width="100" height="40" as="geometry"/>
143+
</mxCell>
144+
<mxCell id="DGV0ISzPH73UszKa0zBS-1" value="&lt;font style=&quot;font-size: 24px;&quot;&gt;&lt;b&gt;Flow Chart&lt;/b&gt;&lt;br&gt;&lt;/font&gt;" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;fontSize=18;" parent="1" vertex="1">
145+
<mxGeometry x="340" width="150" height="40" as="geometry"/>
146+
</mxCell>
147+
</root>
148+
</mxGraphModel>
149+
</diagram>
150+
</mxfile>
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<mxfile host="65bd71144e">
2+
<diagram id="g17YoTLbQOXmc-tnzXz0" name="Page-1">
3+
<mxGraphModel dx="942" dy="632" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0">
4+
<root>
5+
<mxCell id="0"/>
6+
<mxCell id="1" parent="0"/>
7+
<mxCell id="2" value="Ready to play game" style="ellipse;whiteSpace=wrap;html=1;" vertex="1" parent="1">
8+
<mxGeometry x="360" y="90" width="190" height="90" as="geometry"/>
9+
</mxCell>
10+
<mxCell id="14" style="edgeStyle=none;html=1;exitX=0.5;exitY=0.5;exitDx=0;exitDy=0;exitPerimeter=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="3" target="7">
11+
<mxGeometry relative="1" as="geometry"/>
12+
</mxCell>
13+
<mxCell id="15" style="edgeStyle=none;html=1;exitX=0.5;exitY=0.5;exitDx=0;exitDy=0;exitPerimeter=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="3" target="8">
14+
<mxGeometry relative="1" as="geometry"/>
15+
</mxCell>
16+
<mxCell id="16" style="edgeStyle=none;html=1;exitX=0.5;exitY=0.5;exitDx=0;exitDy=0;exitPerimeter=0;entryX=1.007;entryY=0.58;entryDx=0;entryDy=0;entryPerimeter=0;" edge="1" parent="1" source="3" target="2">
17+
<mxGeometry relative="1" as="geometry"/>
18+
</mxCell>
19+
<mxCell id="17" style="edgeStyle=none;html=1;exitX=0.5;exitY=0.5;exitDx=0;exitDy=0;exitPerimeter=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="3" target="6">
20+
<mxGeometry relative="1" as="geometry"/>
21+
</mxCell>
22+
<mxCell id="3" value="Admin" style="shape=umlActor;verticalLabelPosition=bottom;verticalAlign=top;html=1;outlineConnect=0;" vertex="1" parent="1">
23+
<mxGeometry x="730" y="250" width="30" height="60" as="geometry"/>
24+
</mxCell>
25+
<mxCell id="6" value="Questions setup&lt;span style=&quot;color: rgba(0, 0, 0, 0); font-family: monospace; font-size: 0px; text-align: start;&quot;&gt;%3CmxGraphModel%3E%3Croot%3E%3CmxCell%20id%3D%220%22%2F%3E%3CmxCell%20id%3D%221%22%20parent%3D%220%22%2F%3E%3CmxCell%20id%3D%222%22%20value%3D%22Ready%20to%20play%20game%22%20style%3D%22ellipse%3BwhiteSpace%3Dwrap%3Bhtml%3D1%3B%22%20vertex%3D%221%22%20parent%3D%221%22%3E%3CmxGeometry%20x%3D%22350%22%20y%3D%22150%22%20width%3D%22190%22%20height%3D%2290%22%20as%3D%22geometry%22%2F%3E%3C%2FmxCell%3E%3C%2Froot%3E%3C%2FmxGraphModel%3E&lt;/span&gt;" style="ellipse;whiteSpace=wrap;html=1;" vertex="1" parent="1">
26+
<mxGeometry x="360" y="200" width="190" height="90" as="geometry"/>
27+
</mxCell>
28+
<mxCell id="7" value="Quiz game&lt;span style=&quot;color: rgba(0, 0, 0, 0); font-family: monospace; font-size: 0px; text-align: start;&quot;&gt;%3CmxGraphModel%3E%3Croot%3E%3CmxCell%20id%3D%220%22%2F%3E%3CmxCell%20id%3D%221%22%20parent%3D%220%22%2F%3E%3CmxCell%20id%3D%222%22%20value%3D%22Questions%20setup%26lt%3Bspan%20style%3D%26quot%3Bcolor%3A%20rgba(0%2C%200%2C%200%2C%200)%3B%20font-family%3A%20monospace%3B%20font-size%3A%200px%3B%20text-align%3A%20start%3B%26quot%3B%26gt%3B%253CmxGraphModel%253E%253Croot%253E%253CmxCell%2520id%253D%25220%2522%252F%253E%253CmxCell%2520id%253D%25221%2522%2520parent%253D%25220%2522%252F%253E%253CmxCell%2520id%253D%25222%2522%2520value%253D%2522Ready%2520to%2520play%2520game%2522%2520style%253D%2522ellipse%253BwhiteSpace%253Dwrap%253Bhtml%253D1%253B%2522%2520vertex%253D%25221%2522%2520parent%253D%25221%2522%253E%253CmxGeometry%2520x%253D%2522350%2522%2520y%253D%2522150%2522%2520width%253D%2522190%2522%2520height%253D%252290%2522%2520as%253D%2522geometry%2522%252F%253E%253C%252FmxCell%253E%253C%252Froot%253E%253C%252FmxGraphModel%253E%26lt%3B%2Fspan%26gt%3B%22%20style%3D%22ellipse%3BwhiteSpace%3Dwrap%3Bhtml%3D1%3B%22%20vertex%3D%221%22%20parent%3D%221%22%3E%3CmxGeometry%20x%3D%22350%22%20y%3D%22270%22%20width%3D%22190%22%20height%3D%2290%22%20as%3D%22geometry%22%2F%3E%3C%2FmxCell%3E%3C%2Froot%3E%3C%2FmxGraphModel%3E&lt;/span&gt;" style="ellipse;whiteSpace=wrap;html=1;" vertex="1" parent="1">
29+
<mxGeometry x="370" y="320" width="190" height="90" as="geometry"/>
30+
</mxCell>
31+
<mxCell id="8" value="Score" style="ellipse;whiteSpace=wrap;html=1;" vertex="1" parent="1">
32+
<mxGeometry x="370" y="440" width="190" height="90" as="geometry"/>
33+
</mxCell>
34+
<mxCell id="18" style="edgeStyle=none;html=1;exitX=1;exitY=0.3333333333333333;exitDx=0;exitDy=0;exitPerimeter=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="9" target="2">
35+
<mxGeometry relative="1" as="geometry"/>
36+
</mxCell>
37+
<mxCell id="19" style="edgeStyle=none;html=1;exitX=1;exitY=0.3333333333333333;exitDx=0;exitDy=0;exitPerimeter=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="9" target="7">
38+
<mxGeometry relative="1" as="geometry"/>
39+
</mxCell>
40+
<mxCell id="9" value="User" style="shape=umlActor;verticalLabelPosition=bottom;verticalAlign=top;html=1;outlineConnect=0;" vertex="1" parent="1">
41+
<mxGeometry x="100" y="260" width="30" height="60" as="geometry"/>
42+
</mxCell>
43+
</root>
44+
</mxGraphModel>
45+
</diagram>
46+
</mxfile>
Lines changed: 188 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,188 @@
1+
from tkinter import *
2+
from tkinter import ttk
3+
4+
root = Tk()
5+
6+
root.geometry("800x800")
7+
8+
root.title("Quiz Game App")
9+
10+
scrollbar = Scrollbar(root)
11+
scrollbar.pack(side=RIGHT, fill=Y)
12+
13+
label = Label(root, text="Software Engineering Quiz ",
14+
width=28, height=4, font=("algerian", 15))
15+
label.pack()
16+
17+
18+
class Quiz:
19+
print('Welcome to the Software Engineering Quiz')
20+
score = 0
21+
total_questions = 4
22+
23+
def __init__(self):
24+
# self.ask_question()
25+
pass
26+
27+
def ask_question(self):
28+
answer = input('Are you ready to play the Quiz ? (yes/no) :')
29+
30+
if answer.lower() == 'yes':
31+
answer = input(
32+
'Question 1: What programming language was this quiz created in?')
33+
if answer.lower() == 'python':
34+
self.score += 1
35+
print('correct')
36+
else:
37+
print('Wrong Answer :(')
38+
39+
answer = input('Question 2: What is software Engineering?')
40+
if answer.lower() == 'application of engineering principle to the design a software':
41+
self.score += 1
42+
print('correct')
43+
else:
44+
print('Wrong Answer :(')
45+
46+
answer = input('Question 3: what does SDLC stand for?')
47+
if answer.lower() == 'software Development Life Cycle':
48+
self.score += 1
49+
print('correct')
50+
else:
51+
print('Wrong Answer :(')
52+
53+
answer = input(
54+
'Question 4: First phase of software development is:')
55+
if answer.lower() == 'requirement ananlysi':
56+
self.score += 1
57+
print('correct')
58+
else:
59+
print('Wrong Answer :(')
60+
61+
print('Thankyou for Playing the Hacktoberfest quiz game, you attempted',
62+
self.score, "questions correctly!")
63+
mark = (self.score/self.total_questions)*100
64+
print('Marks obtained:', mark)
65+
print('BYE!')
66+
67+
def get_score(self):
68+
return self.score
69+
70+
def validate_question_one(self, question_one_value=''):
71+
if question_one_value.lower() == 'python':
72+
self.score += 1
73+
print('correct')
74+
else:
75+
print('Wrong Answer1')
76+
print('correct answer is python. ')
77+
return True if question_one_value.lower() == 'python' else False
78+
79+
def validate_question_two(self, question_two_value):
80+
if question_two_value.lower() == 'application of engineering principle to the design a software':
81+
self.score += 1
82+
print('correct')
83+
else:
84+
print('Wrong Answer2')
85+
print('correct answer is application of engineering principle to the design a software. It is the Application of engineering principles to the design,development, and support of software and it helps to solve the challenges of low- quality software project. ')
86+
return True if question_two_value.lower() == 'application of engineering principle to the design a software' else False
87+
88+
def validate_question_three(self, question_three_value):
89+
if question_three_value.lower() == 'software development life cycle':
90+
self.score += 1
91+
print('correct')
92+
else:
93+
print('Wrong Answer2')
94+
print('correct answer is software development life cycle. it is a method for designing, developing, and testing high-quality softwarte.')
95+
return True if question_three_value.lower() == 'software development life cycle' else False
96+
97+
def validate_question_four(self, question_four_value):
98+
if question_four_value.lower() == 'requirement ananlysis':
99+
self.score += 1
100+
print('correct')
101+
else:
102+
print('Wrong Answer2')
103+
print('correct answer is requirement ananlysis, as based on it developer design and developed the software.')
104+
return True if question_four_value.lower() == 'requirement ananlysis' else False
105+
106+
def evaluate(self):
107+
self.score = 0
108+
109+
question_one_value = question_one.get()
110+
self.validate_question_one(question_one_value=question_one_value)
111+
112+
question_two_value = question_two.get()
113+
self.validate_question_two(question_two_value=question_two_value)
114+
115+
question_three_value = question_three.get()
116+
self.validate_question_three(question_three_value=question_three_value)
117+
118+
question_four_value = question_four.get()
119+
self.validate_question_four(question_four_value=question_four_value)
120+
121+
print('Thankyou for Playing the Hacktoberfest quiz game, you attempted',
122+
self.score, "questions correctly!")
123+
mark = (self.score/self.total_questions)*100
124+
my_label.config(text="Your score is " + str(mark) + "%")
125+
print('Marks obtained:', mark)
126+
127+
128+
quiz = Quiz()
129+
130+
w1_label = Label(root, text="Question 1: What programming language was this quiz created in?", font=(
131+
"arial", 10), width=100, height=4)
132+
w1_label.pack()
133+
question_one = ttk.Combobox(
134+
root, value=["Python", "Java", "C++"], width=50, height=4)
135+
w1_label.pack()
136+
question_one.current(0)
137+
question_one.pack()
138+
139+
w1_label = Label(root, text="", font=("arial", 10), width=200, height=4)
140+
w1_label.pack()
141+
142+
w2_label = Label(root, text="Question 2:What is software Engineering?", font=(
143+
"arial", 10), width=200, height=4)
144+
w2_label.pack()
145+
question_two = ttk.Combobox(root, width=50, height=4, value=[
146+
"Designing a software", "Testing a software", "Application of engineering principle to the design a software", "None of the above"])
147+
question_two.current(0)
148+
question_two.pack()
149+
150+
w2_label = Label(root, text="", font=("arial", 10), width=200, height=4)
151+
w2_label.pack()
152+
153+
154+
w3_label = Label(root, text="Question 3:what does SDLC stand for?",
155+
font=("arial", 10), width=200, height=4)
156+
w3_label.pack()
157+
question_three = ttk.Combobox(root, width=50, height=4, value=[
158+
"System Design Life Cycle", "Software Design Life Cycle", "System Development Life Cycle", "Software Development Life Cycle"])
159+
question_three.current(0)
160+
question_three.pack()
161+
162+
w3_label = Label(root, text="", font=("arial", 10), width=200, height=4)
163+
w3_label.pack()
164+
165+
w4_label = Label(root, text="Question 4: First phase of software development is:", font=(
166+
"arial", 10), width=200, height=4)
167+
w4_label.pack()
168+
question_four = ttk.Combobox(root, width=50, height=4, value=[
169+
"Coding", "Testing", "Design", "Requirement ananlysis"])
170+
question_four.current(0)
171+
question_four.pack()
172+
173+
w4_label = Label(root, text="", font=("arial", 10), width=200, height=4)
174+
w4_label.pack()
175+
176+
177+
button = Button(root, text="Submit", font=(
178+
"bell mt", 10), command=quiz.evaluate)
179+
button.pack()
180+
181+
182+
# w6_label = Label(root,font=("arial",10),width=100,height=4, textvariable=quiz.get_score())
183+
my_label = Label(root,
184+
text="Score:")
185+
my_label.pack()
186+
187+
188+
root.mainloop()
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import unittest
2+
from hacktoberfest_quiz import Quiz
3+
4+
class TestQuiz(unittest.TestCase):
5+
def test_correct_answer_to_question_one(self):
6+
quiz = Quiz()
7+
self.assertTrue(quiz.validate_question_one('python'))
8+
9+
def test_correct_answer_to_question_two(self):
10+
quiz = Quiz()
11+
self.assertTrue(quiz.validate_question_two('application of engineering principle to the design a software'))
12+
13+
def test_correct_answer_to_question_three(self):
14+
quiz = Quiz()
15+
self.assertTrue(quiz.validate_question_three('software development life cycle'))
16+
17+
def test_correct_answer_to_question_four(self):
18+
quiz = Quiz()
19+
self.assertTrue(quiz.validate_question_four('requirement ananlysis'))
20+
21+
def test_correct_score(self):
22+
pass
23+
24+
if __name__ == "__main__":
25+
unittest.main()
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
python==3.11.2
2+
tkinter==8.6
Loading
Loading
Loading
Binary file not shown.
Binary file not shown.
Loading
Loading
Binary file not shown.

0 commit comments

Comments
 (0)
Please sign in to comment.