Download presentation
Presentation is loading. Please wait.
Published byBaard Antonsen Modified over 5 years ago
1
Visual Programming week # 05 Lists Quiz Tutorial
2
Outline 1. Lists 2. Tutorial # 05: President Quiz 3. Homework # 04
VP Lecture Note by Dr. Hanh Pham 2
3
Lists List = a set of similar things/data
Examples: • a list of phone numbers: { , , …} a list of names: {Emma Smith, Andy Mills,…} “Phone” List: Elements … Index 1 2 … N Phone[1] = … Phone[N]=256=7980 VP Lecture Note by Dr. Hanh Pham 3
4
Tutorial # 05: President Quiz
TASK: A quiz about US presidents (but you can use it as a template to build quizzes on any topic). The user steps through a series of questions, clicking a button to proceed to the next question. The user enters an answer for each question and the app reports whether each answer is correct or not. The PROBLEM (requirements): display a question with an image that relates to the question user can enter/type their answer and click on “SUBMIT” to see if the answer is correct or not ? user can go to another question by clicking on “NEXT” button VP Lecture Note by Dr. Hanh Pham 4
5
Tutorial # 05: President Quiz
INSTRUCTIONS to Build: More guidance and explanation including video instructions are at: 1) Create a new project called “t5_QuizMe” 2) In DESIGN window: • add an Image, set Width=Parent, Height=300 Download and Upload 3 images at: Add 2 labels and 2 buttons 3) Use “Screen Arrangement” to place the Textbox and the “Submit” button 4) RENAME the components VP Lecture Note by Dr. Hanh Pham 5
6
Tutorial # 05: President Quiz
The DESIGN window should look like this: VP Lecture Note by Dr. Hanh Pham
7
Tutorial # 05: President Quiz
Stage 1: Display the question. The DESIGN window should look like this: VP Lecture Note by Dr. Hanh Pham
8
Lists HOW to CREATE a LIST ? a List is a VARIABLE
Click on “Built-In” then “Variables” and get the first block: Drag it to the working area. Click and change the default name “variable” to “QuestionList” (NAME of the LIST) VP Lecture Note by Dr. Hanh Pham 7
9
Lists ADD elements to a LIST:
• Click on “Built-In” then “Lists” and select “call make a list”: • Left Click, choose “TEXT” and get then type the question in that block Plug them into each other as shown • Do the same for ANSWER list and PICTURE list VP Lecture Note by Dr. Hanh Pham 8
10
Lists ADD elements to a LIST:
• Do the same for ANSWER list and PICTURE list. Then, we’ll have 3 lists: VP Lecture Note by Dr. Hanh Pham 8
11
Lists Create INDEX variable to navigate/access elements of a LIST:
• Create a Variable for INDEX of the list and set it initially to 1: (Click on “Built-In” then “Variables” ) • ASSIGN an element of QuestionList to the QuestionLabel use “call select list item”, get it under “Built-In” then “Lists”: • Need to specify list = QuestionList and index = IndexOfCurrentQuestion For NEXT button: increase index by 1 to go to the NEXT element VP Lecture Note by Dr. Hanh Pham
12
Tutorial # 05: President Quiz
Create lists for the questions and pictures, and an index to keep track of your place. Then program the NextButton.Click to show the right question each time.: VP Lecture Note by Dr. Hanh Pham
13
Tutorial # 05: President Quiz
Complete the code by adding an if block that checks if the user has reached the end of the list. VP Lecture Note by Dr. Hanh Pham
14
Tutorial # 05: President Quiz
Add a textbox and button for the user's answer, then use an if block to check whether the submitted answer is correct. VP Lecture Note by Dr. Hanh Pham
15
Tutorial # 05: President Quiz
In Block EDITOR window ADD more blocks: VP Lecture Note by Dr. Hanh Pham
16
Tutorial # 05: President Quiz
ANOTHER (simpler) version of BLOCKS: VP Lecture Note by Dr. Hanh Pham
17
Homework #4: Quiz Me (done at class)
VP Lecture Note by Dr. Hanh Pham
18
Homework #4: Quiz Me (done at class)
VP Lecture Note by Dr. Hanh Pham
19
Homework #4: Quiz Me VP Lecture Note by Dr. Hanh Pham
20
Homework #4: Quiz Me VP Lecture Note by Dr. Hanh Pham
21
References These slides contain materials from many sources including the following: • “App Inventor: Create Your Own Android Apps” by David Wolber, Hal Abelson, Ellen Spertus, Liz Looney, Publisher: O'Reilly App Inventor for Android: Build Your Own Apps - No Experience Required, Jason Tyle • VP Lecture Note by Dr. Hanh Pham 14
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.