Discuss Scratch
- Discussion Forums
- » Questions about Scratch
- » Electronic Safe Project PLEASE HELP !!
- scurnell
-
3 posts
Electronic Safe Project PLEASE HELP !!
I am attempting to write a program for an electronic safe for a school project. The program must follow the criteria below.
1. The safe must have a 4 digit combination which is pre-set to ‘1234’ – the safe should only unlock when this code is entered.
2. The safe should present the user with a welcome message and a prompt to enter the code.
3. If a user makes 3 incorrect attempts to enter a code, the safe will lock everyone out and an alarm will trigger.
4. If a user enters a code that is shorter or longer than 4 digits the safe will reject the code as incorrect but will not count it as a valid attempt, assuming the user made an error.
I have managed to solve the problems for steps 1, 2 & 4, however i cannot seem to work out how to recognise an incorrect 4 digit code in step 3.
[
img]https://scratch.mit.edu/projects/132892234/#editor
Can anybody help
1. The safe must have a 4 digit combination which is pre-set to ‘1234’ – the safe should only unlock when this code is entered.
2. The safe should present the user with a welcome message and a prompt to enter the code.
3. If a user makes 3 incorrect attempts to enter a code, the safe will lock everyone out and an alarm will trigger.
4. If a user enters a code that is shorter or longer than 4 digits the safe will reject the code as incorrect but will not count it as a valid attempt, assuming the user made an error.
I have managed to solve the problems for steps 1, 2 & 4, however i cannot seem to work out how to recognise an incorrect 4 digit code in step 3.
[
img]https://scratch.mit.edu/projects/132892234/#editor
Can anybody help
- card100
-
1000+ posts
Electronic Safe Project PLEASE HELP !!
if <4 = (length of (answer))> thenHope this helps!
Code for if the it is 4 digits
else
Code if it isn't 4 digits
end
![](http://cdn.scratch.mit.edu/scratchr2/static/__2e66d579e9ef210e4db0a27018af2342__/djangobb_forum/img/smilies/smile.png)
-card100
- Discussion Forums
- » Questions about Scratch
-
» Electronic Safe Project PLEASE HELP !!