This assignment will give you practice with arrays. DO NOT USE CLASSES OR ARRAYLISTS on this assignment. Instructions Yo

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

This assignment will give you practice with arrays. DO NOT USE CLASSES OR ARRAYLISTS on this assignment. Instructions Yo

Post by answerhappygod »

This Assignment Will Give You Practice With Arrays Do Not Use Classes Or Arraylists On This Assignment Instructions Yo 1
This Assignment Will Give You Practice With Arrays Do Not Use Classes Or Arraylists On This Assignment Instructions Yo 1 (59.79 KiB) Viewed 26 times
This Assignment Will Give You Practice With Arrays Do Not Use Classes Or Arraylists On This Assignment Instructions Yo 2
This Assignment Will Give You Practice With Arrays Do Not Use Classes Or Arraylists On This Assignment Instructions Yo 2 (73.85 KiB) Viewed 26 times
This Assignment Will Give You Practice With Arrays Do Not Use Classes Or Arraylists On This Assignment Instructions Yo 3
This Assignment Will Give You Practice With Arrays Do Not Use Classes Or Arraylists On This Assignment Instructions Yo 3 (78.08 KiB) Viewed 26 times
This Assignment Will Give You Practice With Arrays Do Not Use Classes Or Arraylists On This Assignment Instructions Yo 4
This Assignment Will Give You Practice With Arrays Do Not Use Classes Or Arraylists On This Assignment Instructions Yo 4 (78.03 KiB) Viewed 26 times
This Assignment Will Give You Practice With Arrays Do Not Use Classes Or Arraylists On This Assignment Instructions Yo 5
This Assignment Will Give You Practice With Arrays Do Not Use Classes Or Arraylists On This Assignment Instructions Yo 5 (60.26 KiB) Viewed 26 times
**one #7 needed **
This Assignment Will Give You Practice With Arrays Do Not Use Classes Or Arraylists On This Assignment Instructions Yo 6
This Assignment Will Give You Practice With Arrays Do Not Use Classes Or Arraylists On This Assignment Instructions Yo 6 (40.75 KiB) Viewed 26 times
This Assignment Will Give You Practice With Arrays Do Not Use Classes Or Arraylists On This Assignment Instructions Yo 7
This Assignment Will Give You Practice With Arrays Do Not Use Classes Or Arraylists On This Assignment Instructions Yo 7 (30.8 KiB) Viewed 26 times
This Assignment Will Give You Practice With Arrays Do Not Use Classes Or Arraylists On This Assignment Instructions Yo 8
This Assignment Will Give You Practice With Arrays Do Not Use Classes Or Arraylists On This Assignment Instructions Yo 8 (57.43 KiB) Viewed 26 times
Please help asap
This assignment will give you practice with arrays. DO NOT USE CLASSES OR ARRAYLISTS on this assignment. Instructions You are going to write a program that will play a solitaire (one-player) game of Mancala. The game of mancala consists of stones that are moved through various buckets towards a goal. In this version of mancala, the user will be able to choose a number of buckets and a number of stones with which to set up the game. The buckets will be created by the program (utilizing an array) and then the stones will be randomly placed into the buckets for set up. Once the game is set up, the user will be asked to choose a bucket from which to pick up stones. These stones will be removed from the original bucket and then placed one by one into subsequent buckets, including the goal. If stones still remain after filling each bucket to the left and the goal, then you return to the front of the buckets to continue distribution. When all stones are moved from the buckets to the goal, the game ends.

Methods At a minimum, your program should have the following static methods in addition to the main: • a method to print the introduction text • a method that sets up the game board (buckets and initial stone placement) • a method that checks if the game is over (all buckets are empty of stones) • a method that prints the board • a method that moves the stones Method: Print Intro Text You need to create a method that will print the intro text for the game. Method: Game Setup You should have a method that prompts the user to choose a number of buckets and a number of stones to be randomly placed in the buckets. You should create an array to represent all the "buckets" (the goal should be stored separate from the buckets - not in the same array). Then randomly assign the stones into the buckets by choosing a random bucket and adding a single stone to that bucket for all the stones you need to randomly place. Method: Check if the Game is Over This method should return true if all the buckets in the array are empty and false if any of the buckets still contains stones that need to be moved to the goal.

Method: Print Board This method should print the board to the screen in the format provided below. Printing the board requires printing the stones in each bucket, the bucket number (starting at 1), and the stones in the goal. The format of printing the board should match the following: Stones: | 01 | 0 | 0 | 2 | >> 0 << Buckets: -1--2--3--4--5- GOAL Note that here, the label "buckets" is presented to the user next to the bucket numbers. And the contents of the buckets (array) is presented to the user next to the word "stones". Method: Move Stones This method should: • carry out a single move of stones (one round) • allow the user to choose the bucket from which they want to remove stones • should distribute these stones beginning from the subsequent bucket, until the end of the array of buckets. If stones still remain on reaching the end, a stone should be distributed to the "goal". If stones still remain after that distribution, stones should continue to be distributed returning to the first bucket (index 0). • If the user's guess is entered in lowercase but appears in the puzzle in uppercase, it should still be marked to be displayed. Likewise, if the user's guess is entered in uppercase but appears in the puzzle in lowercase, it should also be marked to be displayed.

As an example, consider the first two moves (two executions of moving stones) here: ==Move #1 == Stones: 1 3 10 14 1012 | >> 0 << Buckets: -1 -2- -3--4--5- GOAL Which bucket? > 3 4 stones moved. 1 stones added to goal. ==Move #2 -- Stones: 41001 | 3 | >> 1 << Buckets: -1- -2--3--4--5- GOAL Which bucket? > 5 3 stones moved. 1 stones added to goal. ===Move # 3 == Stones: | 5 | 10 | 110 | >> 2 << Buckets: -1--2--3--4--5- GOAL Which bucket? > In the first move, 4 stones are removed from bucket 3. These stones are distributed to bucket 4, bucket 5, the goal, and then bucket 1. In the second move, 3 stones are removed from bucket 5. These stones are distributed to the goal, bucket 1, and bucket 2. Other Notes • On each move of the game, the user should be notified as to how many stones were moved, as well as how many stones were added to the goal. • At the end of the game, the number of total moves played should be printed to the screen. • Remember that arrays are passed by reference to methods, so if you change an array in the method you do NOT need to return it to see the changes take place. • Note that if there are a large number of stones in a bucket then the formatting of the board might be a little off. That is OK. Just make sure that the formatting is correct for single-digit numbers of stones.

Sample Output 1 This program will play a modified solitaire version of the game of Mancala. Your goal is to get all the stones from the buckets on the left into the goal on the right in the least number of moves possible. Before we begin, choose: How many buckets do you want? > 5 How many stones do you want? > 9 OK, let's play the game... ===Move #1== Stones: 1 3 10 14 10 2 1 >> 0 << Buckets: -1 -2--3--4--5- GOAL Which bucket? > 3 4 stones moved. 1 stones added to goal. ===Move #2 == Stones: 40101 | 3 | >> 1 << Buckets: -1 -2- -3--4--5- GOAL Which bucket? > 5 3 stones moved. 1 stones added to goal. ===Move #3 == Stones: 5|1|0|1 | 0 | >> 2 << Buckets: -1--2--3--4--5- GOAL Which bucket? > 1 5 stones moved. 1 stones added to goal. ==Move #4 == Stones: 10 | 2 | 1 | 2 | 1 | »> 3 << Buckets: -1 -2--3--4--5- GOAL Which bucket? > 5 1 stones moved. 1 stones added to goal. ===Move # 5 == Stones: 01211 | 2 | 0 | >> 4 << Buckets: -1 -2--3--4--5- GOAL Which bucket? > 4 2 stones moved. 1 stones added to goal. ===Move #6 == Stones: 1012 | 1 | 0 | 1 | >> 5 << Buckets: -1 -2- -3--4--5- GOAL Which bucket? 5 1 stones moved. 1 stones added to goal. == Move #7 == Stones: 0 | 211 | 0 | 0 | >> 6 << Buckets: -1 -2- -3--4--5- GOAL Which bucket? > 2 2 stones moved.stones added to goal.

===Move #7 == Stones: 0 1 2 1 1 1 0 | 0 | >> 6 << Buckets: -1 -2--3--4--5- GOAL Which bucket? > 2 2 stones moved.stones added to goal. ===Move #8 == Stones: 1 0 1 0 1 2 1 1 1 0 | >> 6 << Buckets: -1 -2--3--4--5- GOAL Which bucket? > 2 That bucket has no stones.stones added to goal. ===Move #9 == Stones: 1 0 1 0 1 2 1 1 1 0 | >> 6 << Buckets: -1 -2--3--4--5- GOAL Which bucket? 3 2 stones moved.stones added to goal. === Move #10 == Stones: 0 0 1 0 1 2 1 1 | >> 6 << Buckets: -1--2--3--4--5- GOAL Which bucket? > 5 1 stones moved. 1 stones added to goal. ==Move # 11 == Stones: 0 0 1 0 1 2 1 0 | >>> <<< Buckets: -1 -2- -3--4--5- GOAL Which bucket? > 4 2 stones moved. 1 stones added to goal. == Move # 12 == Stones: 0 | 0 | 0 | 0 | 1 | >> 8 << Buckets: -1--2--3--4--5- GOAL Which bucket? > 5 1 stones moved. 1 stones added to goal. Nice job! all stones moved to goal in 12 moves.

Sample Output 2 This program will play a modified solitaire version of the game of Mancala. Your goal is to get all the stones from the buckets on the left into the goal on the right in the least number of moves possible. Before we begin, choose: How many buckets do you want? > 3 How many stones do you want? > 1 OK, let's play the game... ===Move #1 == Stones: 0 | 0 | 1 | >> @ << Buckets: -1--2--3- GOAL Which bucket? > 2 That bucket has no stones.stones added to goal. === Move #2 == Stones: 0 | 0 | 1 | >> @ << Buckets: -1 -2--3- GOAL Which bucket? > 3 1 stones moved. 1 stones added to goal. Nice job! all stones moved to goal in 2 moves.

Sample Output 3 This program will play a modified solitaire version of the game of Mancala. Your goal is to get all the stones from the buckets on the left into the goal on the right in the least number of moves possible. Before we begin, choose: How many buckets do you want? > 2 How many stones do you want? > 12 OK, let's play the game... === Move #1 == Stones: | 11 | 1 | >> @ << Buckets: -1 -2- GOAL Which bucket? > 1 11 stones moved. 4 stones added to goal. == Move #2 == Stones: 1 3 1 5 1 >> 4 << Buckets: -1 -2- GOAL Which bucket? > 1 3 stones moved. 1 stones added to goal. == Move #3 == Stones: | 1 | 6 | >> 5 <<< Buckets: -1--2- GOAL Which bucket? > 1 1 stones moved. 0 stones added to goal. == Move #4 == Stones: 10 | 7 | » 5 << Buckets: -1 -2- GOAL Which bucket? > 2 7 stones moved. 3 stones added to goal. == Move #5 == Stones: 1 2 1 2 1 >> 8 << Buckets: -1 -2- GOAL Which bucket? > 1 2 stones moved. 1 stones added to goal. == Move #6 == Stones: 1 3 1 >> 9 << Buckets: -1--2- GOAL Which bucket? > 2 3 stones moved. 1 stones added to goal. == Move #7 - Stones: | 1 | 1 | >> 10 << Buckets: -1--2- GOAL Which bucket? > 2 1 stones moved. 1 stones added to goal. === Move #8 == Stones: | 1 | @ | >> 11 << Buckets: -1 -2- GOAL Which bucket? > 1 1 stones moved.stones added to goal. == Move #9 == Stones: Buckets: -1--2- 1 | » 11 << GOAL Which bucket? > 2 1 stones moved. 1 stones added to goal. Nice job! all stones moved to goal in 9 moves.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply