Sumatoria de puntos (in the President's Quiz tutorial)

Hello about this App; https://gallery.appinventor.mit.edu/?galleryid=5165272670404608
How could I add points to the correct answers and give a result to finish !?
Thank you

That app is discussed in http://www.appinventor.org/bookChapters/chapter8.pdf

Figure 18-13 in that link shows the code in the AnswerButton you can modify to provide a score.

You might create a variable called numberOfCorrectAnswers, initially setting it to 0. Also provide a Label to display the points.

Add the following Blocks under the RightWrongLabel.Text to correct Blocks

numberOfCorrectAnswers = numberOfCorrectAnswers + 1
pointsLabel = numberOfCorrectAnswers

Adding these Blocks will post the results constantly in the Label throughout the quiz.

When you restart the quiz, reset numberOfCorrectAnswers to 0 .

Why not try some code, if you run into difficulty, ask again. Good luck Guido. :slight_smile:

Gracias por responder entendi sobre la variable, entendi de poner una Etiqueta de 1 en el Diseño,
lo otro si lo lee pero no lo puedo materializar porque me es dificil entender desde el texto que me indica no se cuales son los bloques indicados.
Gracias seguire intentado!

What did you try Guido?

Here is a possible way to add a counter that resets to 0 when all the questions are answered.

You can add another Label and some code to display the final score. Try some Blocks :slight_smile:

Look carefully at each of the event handlers. Many blocks were modified from the original tutorial.
Most of the additions are in the AnswerButton but there are many more.

Here are some resources to help you learn to use the AI2 tools. A very good way to learn App Inventor is to read the free Inventor's Manual here in the AI2 free online eBook http://www.appinventor.org/book2 ... the links are at the bottom of the Web page. The book 'teaches' users how to program with AI2 blocks.

There is a free programming course here http://www.appinventor.org/content/CourseInABox/Intro and the aia files for the projects in the book are here: http://www.appinventor.org/bookFiles

How to do a lot of basic things with App Inventor are described here: http://www.appinventor.org/content/howDoYou/eventHandling .

Also look here http://kio4.com/appinventor/index.htm and here http://www.imagnity.com/tutorial-index/ for more tutorials.

Learn about components http://ai2.appinventor.mit.edu/reference/components/
and visit the Library http://appinventor.mit.edu/explore/library Help>Library on the MENU

Good luck.

Thank you.
This is great!
Greetings Good People

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.