Flowchart Conditionals - Activity
Make sure you attempt the activity on your own before checking out the solution.
Instructions:
Imagine you are building a website for a wine distributor. Legally you need to ask a user's age before you allow them into your site.
Using a pencil and paper or a flowcharting software, design the following program:
- A program that, when a user clicks a button, takes in a users age and checks to see if they are 21 or over.
- If they are, display "Welcome to our online store".
- Otherwise, display "You must be 21 or older to enter".
Solution
**All** programming problems essentially can be broken down into these components \(plus 1 or 2 more\): 1. booleans 2. numbers 3. strings 4. arrays 5. loops 6. arithmetic operators 7. accessors like `[]` 8. conditionals/comparator operators 9. event listeners