Question: Using Java Mini-Project 1: Resources Needed: The following subjects should be discussed in this order: General program design. How is the program organized? What major

Using Java

Using Java Mini-Project 1: Resources Needed: The following subjects should be discussedin this order: General program design. How is the program organized? What

Mini-Project 1: Resources Needed: The following subjects should be discussed in this order: General program design. How is the program organized? What major data structures were used? What alternative approaches were considered and why were they rejected? What did you learn from doing this project and what would you do differently? Program Specification: This project involves writing a program to simulate a tortoise and hare race. The contenders will each race along a horizontal course that contains at least 50 positions. You may add more if you wish. The race begins with each contender at position 1. The contender that first reaches or passes the last position of the course is the winner of the race. The following table indicates the types of moves that each contender can make. Contender Type of Move Percentage of Time Result of Move Tortoise Fast plod Slow plod Slip 50% 30% 20% 3 squares to right 1 square to right 6 squares to left Hare Big hop Small hop Big slip Small slip Fall asleep 20% 30% 10% 20% 9 squares to right 1 square to right 12 squares to left 2 squares to left 20% Each contender starts at position 1. When a contender slips, they can't slip any further left than Position 1. You will use a random number generator to simulate the percentages of each type of move indicated in the table. To generate random numbers, you can research the built-in Java random number method that is part of the Math class. For each move for each contender, generate a random integer, n, in the range 1sns 10. For the tortoise, perform a fast plod if the number is 1-5, a slow plod if the number is 6-8, and a slip if the number is 9-10. For the hare, perform a big hop if the number is 1-2, a small hop if the number is 3-5, a big slip if the number is 6, a small slip if the number is 7-8, and fall asleep if the number is 9-10. There are a number of ways to design this program. One way would be to have a looping construct be the overall controller of things. Each iteration would adjust the contender positions, and the loop would terminate when one of the contenders reaches the last square of the race course. You will decide on an approach as part of your design step. You must keep track of each contender's position and display it each time positions change. Show the letter "T" in the position of the tortoise, and the letter "H" in the position of the Hare. Upon moving, it is possible for the contenders to land on the same square. When this happens, the tortoise bites the hare, and your program should display "OUCH!!" beginning at that square. All output positions other than the "T, the H, and the "OUCH!!" should be blank. If the tortoise wins, display "TORTOISE WINS!!". If the hare wins, display "HARE WINS!!. If the race is a tie, display "IT'S A TIE!!. At the beginning of the race, display "AND THEY'RE OFF!!". Mini-Project 1: Resources Needed: The following subjects should be discussed in this order: General program design. How is the program organized? What major data structures were used? What alternative approaches were considered and why were they rejected? What did you learn from doing this project and what would you do differently? Program Specification: This project involves writing a program to simulate a tortoise and hare race. The contenders will each race along a horizontal course that contains at least 50 positions. You may add more if you wish. The race begins with each contender at position 1. The contender that first reaches or passes the last position of the course is the winner of the race. The following table indicates the types of moves that each contender can make. Contender Type of Move Percentage of Time Result of Move Tortoise Fast plod Slow plod Slip 50% 30% 20% 3 squares to right 1 square to right 6 squares to left Hare Big hop Small hop Big slip Small slip Fall asleep 20% 30% 10% 20% 9 squares to right 1 square to right 12 squares to left 2 squares to left 20% Each contender starts at position 1. When a contender slips, they can't slip any further left than Position 1. You will use a random number generator to simulate the percentages of each type of move indicated in the table. To generate random numbers, you can research the built-in Java random number method that is part of the Math class. For each move for each contender, generate a random integer, n, in the range 1sns 10. For the tortoise, perform a fast plod if the number is 1-5, a slow plod if the number is 6-8, and a slip if the number is 9-10. For the hare, perform a big hop if the number is 1-2, a small hop if the number is 3-5, a big slip if the number is 6, a small slip if the number is 7-8, and fall asleep if the number is 9-10. There are a number of ways to design this program. One way would be to have a looping construct be the overall controller of things. Each iteration would adjust the contender positions, and the loop would terminate when one of the contenders reaches the last square of the race course. You will decide on an approach as part of your design step. You must keep track of each contender's position and display it each time positions change. Show the letter "T" in the position of the tortoise, and the letter "H" in the position of the Hare. Upon moving, it is possible for the contenders to land on the same square. When this happens, the tortoise bites the hare, and your program should display "OUCH!!" beginning at that square. All output positions other than the "T, the H, and the "OUCH!!" should be blank. If the tortoise wins, display "TORTOISE WINS!!". If the hare wins, display "HARE WINS!!. If the race is a tie, display "IT'S A TIE!!. At the beginning of the race, display "AND THEY'RE OFF

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!