23 Jan Write a function playGame(maxValue) to perform the following task (its based on an old school yard game called Fuzz Buzz?):
Write a function playGame(maxValue) to perform the following task (it’s based on an old school yard game called “Fuzz Buzz”):
Create a loop that depends on a variable x starting with the value 1 and increasing in value by 1 for each iteration of the loop, until x reaches a maximum value specified by the formal parameter maxVal. At each iteration of the loop the value of x should be displayed, unless one of the conditions shown below is true, when the message specified below should be displayed instead:
• If the value of x is divisible by 11, skip to the next value of x and display the word “skip”.
• If the value of x is divisible by 10, display the word “fuzz”
• If the value of x is divisible by 4, display the word “buzz”
• If the value of x is divisible by both 10 and 4, display the words “fuzz”
and “buzz”, unless the first rule applies.
• Otherwise just display the value of x.
You can find out if a number is ***** by another using the modulo operator %. This tells you the remainder after integer division. For example:
8 % 2 equals 0 as 2 goes into 8 four times leaving no remainder.
8 % 3 equals 2 as 3 goes into 8 two times leaving a remainder of 2.
You should then create a function runGame() that invites the user to enter an appropriate value for maxValue, and then calls the playGame() function accordingly.
Our website has a team of professional writers who can help you write any of your homework. They will write your papers from scratch. We also have a team of editors just to make sure all papers are of HIGH QUALITY & PLAGIARISM FREE. To make an Order you only need to click Ask A Question and we will direct you to our Order Page at WriteDemy. Then fill Our Order Form with all your assignment instructions. Select your deadline and pay for your paper. You will get it few hours before your set deadline.
Fill in all the assignment paper details that are required in the order form with the standard information being the page count, deadline, academic level and type of paper. It is advisable to have this information at hand so that you can quickly fill in the necessary information needed in the form for the essay writer to be immediately assigned to your writing project. Make payment for the custom essay order to enable us to assign a suitable writer to your order. Payments are made through Paypal on a secured billing page. Finally, sit back and relax.