1. Describe your solution for the second project that added a Search button. Provide a screenshot of the search button click code that uses a complex algorithm with loops and lists. Why was a loop necessary?
The search button loops through each question and checks to see if any text in the search text box matches text in the question. If it does, then that question is displayed on the screen. A loop was necessary to go through all of the different questions and set the index equal to the number in the loop.
2. Write AP text-style pseudocode for a linear search that searches through a list to find an item x. It should display found if the x is equal to an item in the list.
When SearchButton clicked
for each number 1 to length of questionList by 1
if list item question List index number contains SearchBox text
then set index to number
call DisplayQuestion
end
3. Give brief descriptions of the enhancements you added to your app for the third project, a quiz topic of your own choosing. Provide screenshots of important blocks and describe how you used them to solve certain programming problems.
I made my quiz about historical facts in Europe. The enhancement that I made added a hint button that people can click and see a hint that pertains to the question they are on. When they go to the next question the hint is hidden again and they can click on the button again to see anew hint. It was necessary to make a separate list for the hints so that they could be paired to the questions of the same index.
4. To practice for the Create project prompt, grab a screenshot of a program code segment from your project that implements an algorithm that includes two or more algorithms within it and includes mathematical and/or logical concepts. An ideal algorithm is a procedure that you created that includes calls to other procedures that you created, where at least one of those includes math or logic (ifs or loops). Describe how each of the two algorithms within the bigger algorithm functions independently as well as in combination to form a new algorithm.
The next button is a segment of code that includes two different algorithms. There is an if statement that checks to see if the index is greater than the amount of questions in the question list. If it is, the index is reset to one and the score is reset to zero, and the score label displays the reset score. The button also calls the DisplayQuestion procedure that initiates the screen that corresponds to the current question. The HintLabel is made blank.