Quiz Program Design w/ App Lab on Code.org
Blog post for Quiz Program Design with App Lab on Code.org.
- Code.org Lecture Notes
- Program Purpose & Function
- Data Abstraction
- Managing Complexity
- Procedural Abstraction
- Algorithm Implementation
- Testing
- Program Design Process/Flowchart
- Key Learnings
Code.org Lecture Notes
- Debug Consoles help us determine whether or not our code is working, and also to identify areas where we messed up the code
Program Purpose & Function
- Purpose: To quiz users on Okinawan Goju-Ryu Karate & The Karate Kid.
- Functionality: Take the user through a series of quiz pages with different questions and answer options on each page. Keep the user’s score and tell it to them at the end. Allow an opportunity to play the game again.
- Input: User clicking on labeled buttons
- Output: Program brings the screen for the next question, correct/incorrect answer screen, or the final score calculators screen
Data Abstraction
- Data is stored as a variable which counts the user’s score as they move through the quiz
- The code segments on the final score screens print the score variable, thus showing it’s use in fulfilling the program’s purpose of quizzing the user and giving them a score
- The variable is called “score” and is defined at the top of the program
- The data contained in the variable “score” is the amount of points the user gathers by answering correct questions in the quiz
Managing Complexity
- My program doesn’t use a list being used to manage complexity in the program
Procedural Abstraction
- Each code segment which responds to the user clicking an answer choice button uses parameters. For example, when the user clicks the correct answer, the program adds 1 to their score and moves to the “correct answer” screen. On the other hand, when the user clicks any one of the 3 incorrect answer options, the program does not add 1 to their score and moves on to the “incorrect answer” screen. The parameter is whether the user selects the correct answer option, and the procedure that is impacted is the addition of the score and the next screen to display.
Algorithm Implementation
- My program does not use an algorithm, I think
Testing
- I included two console log message outputs to ensure that the code works when the user clicks the correct answer option for questions 1 and 2
Program Design Process/Flowchart
Program Design Flowchart
Key Learnings
- Organizing program paths in flowcharts makes it easy to understand what steps the program is taking & how it responds to the user
- Keeping a consistent method of naming buttons/images/pages/variables throughout the quiz makes it easier to call functions for each quiz page