Question: This is a java program I need help on. The Tortoise and the Hare (Simulation:The Tortoise and the Hare)In this program, you will re-create the
This is a java program I need help on.
The Tortoise and the Hare
(Simulation:The Tortoise and the Hare)In this program, you will re-create the classic race of the tortoise and the hare. You will make a class to represent a Hare and one represent a Tortoise. Another class called Race should be used to perform the race.
Our contenders begin the race at "square 1" of 70 squares. Each square represents a possible position along the race course. The finish line is at square 70.The first contender to reach or pass square 70 is rewarded with a pail of fresh carrots and lettuce. The course weaves its way up the side of a slippery mountain, so occasionally the contenders lose ground.
There is a clock that ticks once per second. With each tick of the clock, your progress should adjust the position of the animals according to the rules below.
The classes for Hare and Tortoise should to keep track of the positions of the animals (i.e., position numbers are 1-70).Start each animal at position 1 (i.e., the "starting gate").If an animal slips left before square 1, move the animal back to square 1.
Generate the percentages in the preceding table by producing a random integer i in the range 1 ?i ? 10.For the tortoise, perform a "fast plod" when 1 ?i ? 5, a "slip" when 6 ?i ? 7 or a "slow plod" when 8 ?i ? 10.Use a similar technique to move the hare. This should be encapsulated in a method called move() for each animal class.
Begin the race by printing
BANG !!!!!
AND THEY'RE OFF !!!!!
For each tick of the clock (i.e., each repetition of a loop), print a 70-position line showing the letter T in the tortoise's position and the letter H in the hare's position.Occasionally, the contenders land on the same square.In this case, the tortoise bites the hare and your program should print OUCH!!! beginning at that position.All print positions other than the T, the H or the OUCH!!!(in case of a tie) should be blank.
After printing each line, test if either animal has reached or passed square 70.If so, print the winner and terminate the simulation.If the tortoise wins, print TORTOISE WINS!!!YAY!!!If the hare wins, print HARE WINS.YUCH!.If both animals win on the same clock tick, you may want to favor the tortoise (the "underdog"), or you may want to print It's a tie.If neither animal wins, perform the loop again to simulate the next tick of the clock. When you are ready to run your program, assemble a group of fans to watch the race.You'll be amazed how involved the audience gets!


G Design and im x C Solved: (Simul: x | Mississippi Co x |Homework He X | In Course: GBU3 X T Assignment x |In Assignment x M Inbox (898) - e x Home | MCare X Tn CSC116JSOSP x B Refund Selecti X Frequently Asi X - X C D csc.mc.edu/moodle/mod/assign/view.php?id=5403 ABP Co S # : Apps A Egyptian fractions a... A A possible Mesopot.. Training courses for. http://www.russianl.. http://www.identi.li... * Bookmarks America Has a Mon. @ This Is How to Corr.. The American Drea... R Technology Talent.. W Zen Habits - Wikipe... Other bookmarks CS_isle Q Eliyah Atkins CSC116JSOSP20Lec The Tortoise and the Hare Participants (Simulation:The Tortoise and the Hare)In this exercise, you will re-create the classic race of the tortoise and the hare. You will create a class to represent a Hare and one represent a Tortoise. Another class called Race should be used to perform the race. Badges Our contenders begin the race at "square 1" of 70 squares. Each square represents a possible position along the race course. The finish line is at square 70. The first contender to reach or pass square 70 is rewarded with a pail of fresh Competencies carrots and lettuce. The course weaves its way up the side of a slippery mountain, so occasionally the contenders lose ground. There is a clock that ticks once per second. With each tick of the clock, your progress should adjust the position of the animals according to the rules below. Grades The classes for Hare and Tortoise should to keep track of the positions of the animals (i.e., position numbers are 1-70).Start each animal at position 1 (i.e., the "starting gate").If an animal slips left before square 1, move the animal back General to square 1. Generate the percentages in the preceding table by producing a random integer i in the range 1 si s 10.For the tortoise, perform a "fast plod" when 1 sis 5, a "slip" when 6 si s 7 or a "slow plod" when 8 sis 10.Use a similar Course Information technique to move the hare. This should be encapsulated in a method called move() for each animal class. Java Resources Begin the race by printing BANG ! AND THEY'RE OFF ! Online Course For each tick of the clock (i.e., each repetition of a loop), print a 70-position line showing the letter T in the tortoise's position and the letter H in the hare's position. Occasionally, the contenders land on the same square.In this case, the Information tortoise bites the hare and your program should print OUCH! beginning at that position.All print positions other than the T, the H or the OUCH!!!(in case of a tie) should be blank. After printing each line, test if either animal has reached or passed square 70.If so, print the winner and terminate the simulation.If the tortoise wins, print TORTOISE WINS!YAY!!!If the hare wins, print HARE WINS.YUCH!.If both animals Programming win on the same clock tick, you may want to favor the tortoise (the "underdog"), or you may want to print It's a tie.If neither animal wins, perform the loop again to simulate the next tick of the clock. When you are ready to run your Assignments program, assemble a group of fans to watch the race. You'll be amazed how involved the audience gets! In class coding Percentage of the UML Diagrams for the classes you are to create examples Animal Move Type time Actual Move Race Tortoise Fast plod 50% Chapter 1 - Introduction squares to the right Slip 20% squares to the left + main(String ) Chapter 2 - Data and Expressions Slow plod 30% square to the right Tortoise Hare Sleep 20% No move at all position:int Chapter 3 - Using + move0 Classes and Objects Big hop 20% squares to the right +getPosition() Chapter 4 - Conditionals Big slip 10% 12 squares to the left and Loops Small hop 30% square to the right Hare Chapter 5 - Writing Small slin -position:int 20% 12 squares to the left Type here to search O e 9 BEE G 12:38 PM 4/24/2020G Design and im x C Solved: (Simul: x | Mississippi Co x | Homework He X | In Course: GBU3: X | Th Assignment X x |In Assignment x M Inbox (898) - e x | Home | MCare X In CSC116JSOSP x B Refund Selecti X Frequently Asi X + X C D csc.mc.edu/moodle/mod/assign/view.php?id=5403 REP S # : Apps A Egyptian fractions a... A A possible Mesopot. Training courses for... http://www.russianl.. http:/www.identi.li.. * Bookmarks America Has a Mon. @ This Is How to Corr.. The American Drea.. R Technology Talent. W Zen Habits - Wikipe.. Other bookmarks CS_isle Q Eliyah Atkins Our contenders begin the race at "square 1" of 70 squares. Each square represents a possible position along the race course. The finish line is at square 70. The first contender to reach or pass square 70 is rewarded with a pail of fresh CSC116JSOSP20Lec carrots and lettuce. The course weaves its way up the side of a slippery mountain, so occasionally the contenders lose ground. There is a clock that ticks once per second. With each tick of the clock, your progress should adjust the position of the animals according to the rules below. Participants The classes for Hare and Tortoise should to keep track of the positions of the animals (i.e., position numbers are 1-70).Start each animal at position 1 (i.e., the "starting gate").If an animal slips left before square 1, move the animal back Badges to square 1. Generate the percentages in the preceding table by producing a random integer i in the range 1 si s 10.For the tortoise, perform a "fast plod" when 1 sis 5, a "slip" when 6 si s 7 or a "slow plod" when 8 sis 10.Use a similar Competencies technique to move the hare. This should be encapsulated in a method called move() for each animal class. Begin the race by printing Grades BANG ! AND THEY'RE OFF ! General For each tick of the clock (i.e., each repetition of a loop), print a 70-position line showing the letter T in the tortoise's position and the letter H in the hare's position. Occasionally, the contenders land on the same square.In this case, the tortoise bites the hare and your program should print OUCH!! beginning at that position.All print positions other than the T, the H or the OUCH!!!(in case of a tie) should be blank. Course Information After printing each line, test if either animal has reached or passed square 70.If so, print the winner and terminate the simulation.If the tortoise wins, print TORTOISE WINS!YAY!!!If the hare wins, print HARE WINS.YUCH!.If both animals win on the same clock tick, you may want to favor the tortoise (the "underdog"), or you may want to print It's a tie.If neither animal wins, perform the loop again to simulate the next tick of the clock. When you are ready to run your Java Resources program, assemble a group of fans to watch the race. You'll be amazed how involved the audience gets! Percentage of the UML Diagrams for the classes you are to create Online Course Animal time Actual Move Information Move Type Race Tortoise Fast plod 50% squares to the right Programming Slip 20% squares to the left + main(String ) Assignments Slow plod 30% square to the right In class coding Tortoise examples Hare Sleep 20% No move at all -position:int + move0 Chapter 1 - Introduction Big hop 20% squares to the right +getPosition() Big slip 10% Chapter 2 - Data and 12 squares to the left Expressions Small hop 30% 1 square to the right Hare -position:int Chapter 3 - Using Small slip 20% 2 squares to the left + moved Classes and Objects Rules for moving the tortoise and the hare. +getPosition() Chapter 4 - Conditionals and Loops Chapter 5 - Writing O 9 EE G 12:38 PM Type here to search 4/24/2020
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
