Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Language to be used- Java In this exercise, you will re-create the graphics version of classic race of the tortoise and the hare for a

Language to be used- Java

image text in transcribed

image text in transcribed

In this exercise, you will re-create the graphics version of classic race of the tortoise and the hare for a Two-lap race. You will use random number generation to develop a simulation of this memorable event You will also add two buttons (Start and Stop) for your race. User should be able to click on the buttons using Mouse or keyboard shortcut (of your choice) to press the buttons. START Simulate two mountains by drawing a line that extends from bottom-right corner of the window to the midpoint of line from center of the screen to the right end and then to the bottom-center point. Similarly draw the second mountain from bottom-center to midpoint of a line from center to left end of the screen and from there to bottom right corner (See the figure above showing two mountains). The tortoise and the hare should race up the first mountain (towards your right hand side) and then race down from that mountain and continue onto second mountain. This process will be repeated in reverse. For each lap, they will start at the bottom of the mountain, race up to the top, and continue racing until they reach down to the end of first mountain and then continue onto the second mountain. Implement the graphical output to actually print the tortoise and the hare on the arc for every move (See below for details) Our contenders begin the race at "square 1" of 640 squares. Each square represents a possible position along the race course. The top of the mountain is at square 160. The first contender to reach or pass square 160 (top) will continue moving in downward direction. The first contender to cross or pass the square 320 will continue onto the second mountain. The first contender to cross or pass the square 640 will change direction and then continue in the reverse direction. The winner reaches the starting point first (i.e., bottom left corner). The winner is rewarded with a pail of fresh carrots and lettuce. The course weaves its way up (and down) the side of a slippery mountain, so occasionally the contenders lose ground There is a clock that ticks 2 times per second. With each tick of the clock, your program should adjust the position of the animals according to the rules in table below In this exercise, you will re-create the graphics version of classic race of the tortoise and the hare for a Two-lap race. You will use random number generation to develop a simulation of this memorable event You will also add two buttons (Start and Stop) for your race. User should be able to click on the buttons using Mouse or keyboard shortcut (of your choice) to press the buttons. START Simulate two mountains by drawing a line that extends from bottom-right corner of the window to the midpoint of line from center of the screen to the right end and then to the bottom-center point. Similarly draw the second mountain from bottom-center to midpoint of a line from center to left end of the screen and from there to bottom right corner (See the figure above showing two mountains). The tortoise and the hare should race up the first mountain (towards your right hand side) and then race down from that mountain and continue onto second mountain. This process will be repeated in reverse. For each lap, they will start at the bottom of the mountain, race up to the top, and continue racing until they reach down to the end of first mountain and then continue onto the second mountain. Implement the graphical output to actually print the tortoise and the hare on the arc for every move (See below for details) Our contenders begin the race at "square 1" of 640 squares. Each square represents a possible position along the race course. The top of the mountain is at square 160. The first contender to reach or pass square 160 (top) will continue moving in downward direction. The first contender to cross or pass the square 320 will continue onto the second mountain. The first contender to cross or pass the square 640 will change direction and then continue in the reverse direction. The winner reaches the starting point first (i.e., bottom left corner). The winner is rewarded with a pail of fresh carrots and lettuce. The course weaves its way up (and down) the side of a slippery mountain, so occasionally the contenders lose ground There is a clock that ticks 2 times per second. With each tick of the clock, your program should adjust the position of the animals according to the rules in table below

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

DATABASE Administrator Make A Difference

Authors: Mohciine Elmourabit

1st Edition

B0CGM7XG75, 978-1722657802

More Books

Students also viewed these Databases questions