Write parameterized function to play the game

Assignment Help Programming Languages
Reference no: EM1363816

Your program cannot use file level variables or constants; your program cannot use global variables or constants. The functions that you write exchange data by means of return statements and value parameters and reference parameters only.

1. Change the pickUpSticks program so that the player who picks up the last sticks or sticks wins.

2. Write a parameterized function that plays the game. You must determine the function's parameters.

3. Write a Boolean function that has one string parameter and returns true if the user enters "Y", "YE" or "YES" and false otherwise. Use the trim and toupper functions to edit the user's input string. Use the function to determine whether the player plays the game. For example,

answer = readAnswer(prompt)
while answer is true
play game
answer = readAnswer(prompt)
end while

4. Write a void function that reads the game's parameters from a file. The function validates the parameters. If the parameters are "bad" the function assigns default values to the parameters. What is a "bad" parameter? If the maximum number of sticks the player can pick up is 3 and the initial number of sticks is 16 then the first player may lose. "16" is a bad parameter. We want the first player to win as long as the player makes no mistakes. The function returns the validated parameters.

Reference no: EM1363816

Questions Cloud

Illustrate what is the profit-maximizing price and quantity : Hair Grow Co. has a demand curve of P=101-.00002Q Marginal cost for producing Hair Grow pill is $1. Illustrate what is the profit-maximizing price and quantity. What is the profit.
Importance of power in a relationship between married couple : What are some factors that lead to short-term attraction and long-term attraction in a relationship and what is the importance of power in a relationship between married couples?
Market value ratio of debt to debt : There was an upward trend in the ratio of the book value of debt to book value of debt and equity throughout the 1990s. Some of this was due to the rebuying of stock.
Fixed costs and maximizing firm value : To maximize the firm value, should GS accept the Kojo offer? Why or why not? Given the data, what is GS weekly fixed cost of producing the tiger head covers? Besides the data provided above, what other factor should GS consider before making the deci..
Write parameterized function to play the game : Your program cannot use file level variables or constants; your program cannot use global variables or constants. The functions that you write exchange data by means of return statements and value parameters and reference parameters
Explain formal presentations are always much longer : Explain formal presentations are always much longer and formal presentations are often delivered from a stage or platform.
Calculate the force and the total work required in each case : compute the force and the total work required in each case. Find the tension in each of the cables.
Managing cross-functional teams : Managing Cross-Functional Teams - What do you need to do to manage cross-functional teams? How can a manager maintain order in such a diverse group?
Estimate the statement choices of your fellow students : Provide one quote and its context for both a positive and normative statement. Explain your choices. Estimate the statement choices of your fellow students.

Reviews

Write a Review

Programming Languages Questions & Answers

  Determining suitable parameters if pass-by-reference is used

Subprocedures in VBA utilize pass-by-reference. Which function or sub procedure alters its parameter?

  Javascript for metric conversions

Write a javascript that will assist the user with metric conversions. Your program should allow the user to specify the names of the units as strings.

  Design a website to allow calculation of areas

Design a website to permit calculation of areas. A radio button list can be used to allow the user select what type of area to be calculated. Once the selection is done, the input text boxes should be displayed with the proper labels.

  Calculating hit ratio for program having loops

Calculate hit ratio for program that loops 10 times from locations 0 - 64.

  Write program to enter numeric values-arithmetic operator

Write a program that lets the user enter 2 numeric values, and an arithmetic operator: +, -, * and /. Write a switch statement that displays the result.

  Program to output circle-s radius-diameter-circumference

Write a program to prompt the user to enter center and a point on circle. Program must then output circle's radius, diameter, circumference, and area.

  Create class has constructor to reduce function of fraction

Create a class RationalNumber (fractions) with the following functionality: Has a constructor that prevents a 0 denominator in a fraction and calls the reduce function to simplify the fraction

  Create two global varibles to declare an empty array

Need to create two global varibles. The first currentTab, which will reference the current menu tab being dispalyed with a initial value of null, the second variable is maxZ which will store the z-index and it's initial value is 1.

  Explaining exception handling using program

Use exception handling appropriately. Use comments to illustrate the various concepts applied / utilized in the solution.

  Create logic for program-continously prompts for numeric

Create the logic for a program that continously prompts the user for two numeric values that represent the sides of a rectangle.

  Write the code required to analyse and display

Engineer for a materials manufacturing research lab and have been asked to provide an automated solution to analyse data.

  Explain drawbacks to using ajax technology

What are some of the other drawbacks to using AJAX technology? Why are some of these very significant items to consider before implementing AJAX on a given website?

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd