Algorithm Patterns Questions.

Question 1 : 1. Write an algorithm to print following pattern P pr pro prog progr program program Implement the algorithm using OUBuild script following the above steps and provide clear screenshots for the OUbuild code with output Question 2 : A friend, Anna, has a lot of books in her house. She has asked me to create a program that will keep and display a list of the book titles. She wants to be able to add a book title to the list. So, you are requested to write a program to help Anna to add a book title to the list according to the following specifications: • • Create a list of book titles containing minimum 5 titles. Ask the user to enter a book title o If the book title exists in the list, then it shouldn’t be added to the list and a message should be displayed informing the user that the title is a duplicate. o If the book title doesn’t exist in the list, then it should be added to the list and a message should be displayed informing the use that the title has been added to the list. To answer question 2, you need to do the following: 1. You need to write a small draft for what kind of gathering information and question you need before you design the algorithm. 2. Based on the above explanation write an algorithm to help Anna in entering a book into the books list without duplication. 3. Draw a flowchart of the algorithm 4. Explain your algorithm and how it works by your own words. 5. Implement the algorithm using OUBuild script. 6. Provide a screenshot of the OUBUILD program. 7. Provide two screenshots of the output, one showing the case when you enter a new book to the list and another showing adding an existing book to the list Question 3: Each year the College has an election for student club chairman. The students who were passed in the election among the College are preparing the list of candidates who will be the chairman for the club. They put all candidate in a list called (candidate) and recorded the votes in a different list called (votes). • In the program you will construct you are requested to create 2 lists one for candidate and one for votes • Initialize Candidate list with at least 3 names. • Initialize Votes list with at least 10 vote names. • The program should count the votes of each candidate and declare the winner. For example: Candidate Ahmad Rami Sara ……. Votes Rami Ahmad Rami Rami Sara ………. O To answer question 3 you need to do the following: 1- You are required to write an algorithm that will find and display the winner based on the above steps. 2- Implement your algorithm by the OUBUILD 3- Provide two screenshots with different output TM111 7 7451 Winner 2 Votes 2 MaxVotes candidate 1 Ahmad 2 Rami 3 Sara length: 3 votes 1 Rami 2 Ahmad 3 Rami Rami CurrentCandidate currentVote 11 4 Rami 5 Sara 6 Rami 7 Rami 8 Sara 9 Ahmad 10 Rami + length: 10 X: 240 y: 180