Css Microproject
Css Microproject
PROJECT REPORT
ON
( COMPUTER ENGINEERING )
SUBMITTED TO
SUBMITTED BY
CERTIFICATE
This is to certify that the project report entitled “Math Multiplication Game”
Was successfully completed by Student of fifth semester Diploma in Computer
engineering.
Groups Member:
2
Acknowledgement
I also thanks Prof. Nawale S.K. for giving this opportunity to explore
into the real world and realize the interrelation without which a Project can
never progress. In this present project I have chosen the topic“Math
Multiplication Game.
Group Member:-
3
ANNEXURE II
37 Borude Shivani
Shivraj
4
Index
5
Micro Project Report
1. Rational –
3. Course Outcomes –
Co. Course Outcome Statement
No.
CI505. 1 Use3 different program flow control structure for design interactive web
pages.
CI505. 3 Implement3 event based web forms and handling cookies using Java
script.
6
4 Literature Review –
1) Variable :
Variables are “containers” for storing information. It is an Identifire that
indicates a storage location in computer memory and it is used to refer the data
stored at a memory location.
2) ‘Function :
A function in JavaSeript is similar to a procedure which is a set of statements that
performs a task or calculates a value, but for a procedure to qualify as a function, it
should take some input and return an output where there is some obvious
relationship between the input and the output.
7
3) If...clse Statement :
The if...else statement allows JavaScript to execute
statements in more controlled way. We can use the if...clse statement to
execute some code if a condition is true and another code if the condition is
not true i.e, false.
The keyword if executes a statement only if the condition is true. It does not
do anything if the condition is false.
do...while Statement :
This statement executes atleast once, condition is false. In this, the loop will
execute the code block ance, before checking if the condition is true. then it
will repeat the loop as long as the condition is true.
‘getElementByld Method: It returns a reference to the element by its ID.
Syntax :
element = document. getElementByld(id):
8
5. Actual Procedure Followed –
Algorithm;
Step 1. Start
Step 2. Create HTML structure by adding the 4 boxes, scoreboard and reset button.
Step 3. Declare and initialize the DOM objects in Js.
Step 4. Call function play A question along with 4 options will be displayed.
Step 5. Select the option you feel is correct.
5.1 If Selected Option Is Correct, Display : Correct
5.2 If Selected Option Is Incorrect, Display : Try
Again! Step 6. Check if option selected is correct or incorrect
6.1 1f Option Selected is Correct :
Increment to Next Question
Display : Score
Display : Time Remaining
If Option Selected is Incorrect
Execute the same question again
Display : Score
Display : Time Remaining
Step 7. Final Function
7.1 Function Success: Check if user's time remaning is equal to 0, if YES
then display user's performance stats with total time taken.
Step 8. IT user wants to play again or if user clicks reset button in between, Go to step
4 Step 9. Stop.
9
Information About Project:
Code:
<!DOCTYPE html>
<html lang="en">
<head>
<title>Math Game</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div id="container">
<div id="score">Score: <span id="scoreValue"></span></div>
<div id="correct">Correct</div>
<div id="wrong">Wrong<br>Try Again!</div>
<div id="question" class="text-center"></div>
<div id="information" class="text-center" onclick="check()">Click on the correct
answer!</div>
<div id="choices">
<div id="box 1" class="box text-center"></div>
<div id="box2" class="box text-center"></div>
<div id="box3" class="box text-center"></div>
<div id="box4" class="box text-center"></div>
</div>
<div id="startreset" class="text-center">Start Game</div>
<div id="timeremaining" class="text-center">Time Remaining: <span
id="timeremainingValue"></span></div>
<div id="gameover" class="text-center"></div>
</div>
<script src="main.js"></script>
</body>
</html>
10
JAVASCRIPT
// Global Variables var playing = false; var score; var timeremaining; var
countdown; var correctAns=0; // Register Events
document.getElementById("startreset").addEventListener("click", play);
document.getElementById("box1").addEventListener("click", checkAnswer);
document.getElementById("box2").addEventListener("click", checkAnswer);
document.getElementById("box3").addEventListener("click", check
Answer); document.getElementById("box4").addEventListener("click",
checkAnswer); function play(e){ if(playing===true) {
//You want to reset
window.location.reload();
} else {
//You want to start the play playing = true;
this.innerHTML = "Reset Game": score =
0; setText("scoreValue", score);
hide("gameover");
timeremaining = 60;
setText("timeremainingValue", timeremaining);
show("timeremaining");
startCountdown();
generateQA();
}
}
function generateQA()
{ document.getElementById('information').innerHTML="Click on
the correct answer!"; var x = (1 + Math.round(Math.random() *
9)): var y = (1 + Math.round(Math.random() * 9)):
correctAns = x * y; let quesString = 'S{x} x ${y}';
setText("question", quesString); var correctPos =
(1
+ Math.round(Math.random() * 3)); setText('box$
{correctPos}', correctAns); var
answers =[correctAns]; for(i=1; i<5; i++) {
var wrongAns; if(i!= correctPos) {
do {
wrongAns= (1 +Math.round(Math.random()*9)) * (1
+Math.round(Math.random() * 9));
} while(answers.indexOf(wrongAns) != -1);
setText('box${i}', wrongAns);
answers.push(wrongAns);
}
11
}
}
function check()
{
document.getElementById('information').innerHTML=correct Ans;
}
function checkAnswer() { if(playing true) { if(this.innerHTML = correctAns)
{
score++;
setText("scoreValue", score);
show("correct");
setTimeout(function(){hide("correct");}, 500); generateQA();
}
else
{ show("wrong");
setTimeout(function() { hide("wrong"); },500);
}
}
}
function startCountdown(){ countdown setInterval(function()
{ timeremaining -=1; //timeremaining = timeremaining -1
setText("timeremaining Value",timeremaining);
if(timeremaining<=0){
clearInterval(countdown);
playing-false;
show("gameover");
hide("timeremaining");
setText("scoreValue","");
setText("startreset", "Start Game");
let msg=<p>Game over!</p><p>Your score:${score}</p>';
setText("gameover",msg);
}
},1000)
}
/*HELPER FUNCTIONS */
function setText(id, text)
{ document.getElementById(id).innerHTML = text;
}
function show(id)
{ document.getElementById(id).style.display =
'block';
}
12
function hide(id)
{ document.getElementById(id).style.display =
'none';
}
CSS
html {
14
7. Output of Micro Project –
15
8. Skill Developed Learning Outcomes –
• Math games can improve visual recognition and can be used as Math Test/ Quiz.
• With many Math games based on calculating easy to tough levels of
math problems, children improve their visual discrimination.
• It improves other brain functions, such as attention, concentration, and focus.
It is very user-friendly, Interactive UI and UX and A Fun & Learn Game.
• These games improve visual memory, sustained attention, and
visual recognition skills.
16
10. Reference:
https://www.cloudflare.com/learning/serverless/glossary/client-side-vs-server-
side/#:~:text=Client%2Dside%20scripting%20simply%20means,because%20JavaScr
ipt%20is%20universally%20supported.
https://stackoverflow.com/questions/61051414/can-someone-explain-this-piece-of-
javascript-code
https://www.w3schools.com/js/js_examples.asp
https://www.javatpoint.com/javascript-example
https://www.programiz.com/javascript/examples
https://playcode.io
https://skillcrush.com/blog/projects-you-can-do-with-javascript/
Book javascript
https://codingtorque.com/math-game-using-javascript/
https://codepen.io/bobbidigi34/pen/rWzZgQ
https://codingartistweb.com/2022/08/math-game-with-javascript/
https://www.mathplayground.com/math-games.htmlhttps://www.mathgames.com/
17
THANK YOU
18