The contenders are tortoise and hare

Assignment Help Basic Computer Science
Reference no: EM13168152

The contenders are Tortoise and Hare, and they begin race as investors at "tile 1" of 70 tiles The finish line is at 70 the tile. With each tick of the clock , the program should use function of moveTortoise and moveHare. The functions should use pointer-based pas-by-reference to modify the position of the tortise and the Hare. Use variable to keep track of the positions of the animals(i.e position numbers are 1-70). For each tick of the clock, display a 70-position line showing the letter T in the tortoise's position and letter H in the Hare's position.

Implement a class Tile with the following propertises:

  • Admission Cost(randomize cost between $3 and $10)
  • Tile Cost(randomize cost between $6 and $20)
  • Cost to build one Green hose(5 xTile Cost)
  • Green House Count
  • Investor *owner
  • void place(Investor*) - Function is called to place Investor on Tile

Implement a class Investor with the following propertises:

  • Name of Investor
  • Cash Savings Balance (initialize to $1500)
  • Total vale of assets(initialize to $0)
  • void savingsdeposit(double amount) - Deposits money into cash savings balance
  • void assetDeposit(double amount) - add to the vale of assets
  • double withdraw(double amount)

The race between two investors (Tortoise and Hare) who are both trying to race through a series of tiles without going bankrupt. If an investor goes bankrupt before they cross the finish line then they are out of the race. The investor who gets to the finish line first without going bankrupt will win a vacation away from the money making game.

RULES FOR LANDING ON A TILE:

  • If an investor lands on a tile and has sufficient money to purchase tile (provided the tile has not been sold), then the investor must purchase that Tile. Remember to update the total value of assets for this investor.
  • If an investor lands on a tile that is owned by a different investor then that investor must pay the admission cost to the owner.
  • If an investor lands on a tile that he/she already owns then it must try to purchase a Green House (remember to increment green house count)
  • If the investor doesn't have enough cash to purchase an available tile then do nothing.
  • The admission cost of a tile with one or more green house is:

Sample output after the race:

Investor: Hare

Cash Savings Balance: $5000

Total Value of Assets: $18000

Investor: Tortoise

Cash Savings Balance: $3000

Total Value of Assets: $4000

Reference no: EM13168152

Questions Cloud

Decimal digit in bcd : Design a combinational circuit with four input lines that represent a decimal digit in BCD and four output lines that generate the 9's complement of the input digit.
Evaluate a user''s expression : Write a function that will evaluate a user's expression. It should call the getExpression function that you previously wrote to get the expression to evaluate from the user. You should evaluate the expression step-by-step.
Calculate the celsius equivalent of a fahrenheit temperature : Construct a program that allows you to calculate the Celsius equivalent of a Fahrenheit temperature.
Create an application in which a user can enter a phone book : Create an application in which a user can enter a phone book entry, including the following elements: First Name, Last Name, Phone Number, email address
The contenders are tortoise and hare : The contenders are Tortoise and Hare, and they begin race as investors at "tile 1" of 70 tiles The finish line is at 70 the tile. With each tick of the clock
The mips architecture reserves register : The MIPS architecture reserves register 0 (called $zero) to be always equal to 0. This allows synthesizing additional addressing modes and additional instructions from the instruction set.
Calculates the position of a cannonball : Write a c++ program that calculates the position of a cannonball that is fired straight up in the air. Use short time intervals (.01 seconds) and display the position and velocity every second.
Indicate the changes : Indicate the changes (using the shorthand representation) that you would need to make to the original Premiere Products database design to support the following requirements. There is no relationship between customers and sales reps.  When a custo..
You can push multiple operands on the stack : You can push multiple operands on the stack. The operation will always use the two topmost values. For example, to evaluate (A+B+C), you can use the code below:

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Odd-length cycle in directed graph by linear-time algorithm

Give a linear-time algorithm to find an odd-length cycle in a directed graph. You may NOT assume that the graph is strongly connected.

  Use map to define convert-euro converts list of us dollars

Use map to define the following functions: convert-euro, which converts a list of U.S. dollar amounts into a list of euro amounts based on an exchange rate of 1.22 euro for each dollar.

  User defined company class

Create a user defined Company class the class will include Company Name, Stock Symbol and stock value per share. Include a parameterized constructor and get methods for each of the instance variables. Also include a toString method.

  Web service management

How is Web service management different from conventional distributed computing  systems management?

  Storage of an unordered collection of items

Storage of an unordered collection of items that facilitates efficient, random access of items based on an item's position in the collection.

  Write a scheme funtion that takes a list

Write a Scheme funtion that takes a list and an atom as parameters and returns a list identical to its parameter list except with all top level instances of the given atom deleted

  Store configuration information on motherboard in cmos

Why do you believe the trend is to store configuration information on the motherboard in CMOS setup rather than by using jumpers or switches?

  Dynamic programming

Please provide with a detailed answer using DYNAMIC PROGRAMMING

  Examples of emerging technologies

Assume you are an Information Systems educator, and you have been asked to make an article about emerging technologies and how important it is to be prepared to adapt to new technologies

  Determine minimum number of pieces for location of centroid

Determine the minimum number of pieces which can be used in determining location of the centroid? For finiding the centroid of area, two square segments are considered; square ABCD and square DEFG.

  Compute the shortest path

Use Dijkstra's shortest-path algorithm to compute the shortest path from x to all network nodes - computes their Distance Vector for network

  Which shipper service to choose for company

Your task is to choose the best shipper for company. Compare these shippers, like FedEx (www.fedex.com), UPS (www.ups.com), and the U.S. Postal Service (www.usps.gov).

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