Lab 13 Arrays In this lab you will practice working with arrays. Arrays allow you to group data of

Lab 13 Arrays In this lab you will practice working with arrays. Arrays allow you to group data of the same type together using one variable name and index numbers to access each of the elements. Example Program The example program for this lab is a rewritten version of Lab 12. In the Reference Parameters lab you wrote a program that found the average of 5 judges' scores, minus the minimum and maximum score. You had to repeat a lot of code in that lab in order to get input from each judge, and to find the minimum and maximum values. The example program uses an
Lab 13 Arrays In this lab you will practice working with arrays. Arrays allow you to group data of the same type together using one variable name and index numbers to access each of the elements. Example Program The example program for this lab is a rewritten version of Lab 12. In the Reference Parameters lab you wrote a program that found the average of 5 judges' scores, minus the minimum and maximum score. You had to repeat a lot of code in that lab in order to get input from each judge, and to find the minimum and maximum values. The example program uses an array to store the judges' scores. This allows us to use for loops to get the input, to find the minimum and maximum, and to take the sum. A huge benefit of using arrays is that we can make the functions that find the minimum and maximum, and that take the average, more general. These functions can now use an array of numbers of any size (not just 5). The number of judges is set by a constant at the top of the source file. If you want to run the program with more (or fewer) judges, all we have to do is change the value of that constant, and everything else will change automatically. Try it out! Download the AverageScore_Array.cs file, examine the code, and run the program. Pay attention to how to use arrays as a parameter to a function. Notice that in addition to the array, another variable is always included to specify the size of the array. Your Program For your program you will complete code that plays the War card game. In this game, the deck of cards is evenly divided among two players. The players are not allowed to look at the cards in their hand. On each round of the game, both players lay down the top card from their hand. The player with the higher value card wins both cards and places the cards on the bottom of his hand. For our version of the game, in the case of a tie, each player places their card back at the bottom of their hand (the real game has different rules for ties). Game play continues until one of the players has all of the cards. In order to simplify our program, our “deck” is a series of random numbers ranging from 1 to 13 (because a real deck of cards has 13 values). The size of the deck is set by a constant. This game can take a long time to play, so a deck size of 10 cards is a reasonable size for testing the game. You can change the deck size if you wish, although larger numbers will likely take much longer to finish. The main function is provided to you in warGame.cs. You should not make any modifications to this function, or to the other two functions provided (to print the results of each round of the game, and to create the “deck” of cards.) You will write two functions, described below. Remember to write small parts of the program at a time and test each part before moving on to the next part. CITP 3310 Survey of Programming Languages Lab 13 Function 1: Deal the Cards. This function takes the deck of cards and splits it between the two players by alternately dealing a card to each player. Note that the array for each player's hand is the same size of the deck. This is because we need to be able to store all cards in the winner's hand. Therefore, the array for each player's hand is a partially filled array. In the main function I initialized all elements of the players' hand arrays to zero. In our game, when an array element has the value zero it indicates that there is no card at that index. All of the cards must be placed at the beginning of the array. An example of a deck dealt to two players is shown below. Deck: 3 1 13 5 8 4 3 10 6 9 Player 1's Hand: 3 13 8 3 6 0 0 0 0 0 Player 2's Hand: 1 5 4 10 9 0 0 0 0 0 Function 2: Shift the Cards Forward. This function moves all cards in a hand one place forward, removing the first card and setting the value of the last card to zero. This simulates a player removing a card from her hand. An example of a hand of cards before and after shifting is shown below. Before shift: 3 13 8 3 6 0 0 0 0 0 After shift: 13 8 3 6 0 0 0 0 0 0 Challenge I think this one will be challenging enough If you complete this lab, Ill throw in the 10 bonus points for free

Custom Paper Help
Calculate your paper price
Pages (550 words)
Approximate price: -

Why Work with Us

Top Quality and Well-Researched Papers

We always make sure that writers follow all your instructions precisely. You can choose your academic level: high school, college/university or professional, and we will assign a writer who has a respective degree.

Professional and Experienced Academic Writers

We have a team of professional writers with experience in academic and business writing. Many are native speakers and able to perform any task for which you need help.

Free Unlimited Revisions

If you think we missed something, send your order for a free revision. You have 10 days to submit the order for review after you have received the final document. You can do this yourself after logging into your personal account or by contacting our support.

Prompt Delivery and 100% Money-Back-Guarantee

All papers are always delivered on time. In case we need more time to master your paper, we may contact you regarding the deadline extension. In case you cannot provide us with more time, a 100% refund is guaranteed.

Original & Confidential

We use several writing tools checks to ensure that all documents you receive are free from plagiarism. Our editors carefully review all quotations in the text. We also promise maximum confidentiality in all of our services.

24/7 Customer Support

Our support agents are available 24 hours a day 7 days a week and committed to providing you with the best customer experience. Get in touch whenever you need any assistance.

Try it now!

Calculate the price of your order

Total price:
$0.00

How it works?

Follow these simple steps to get your paper done

Place your order

Fill in the order form and provide all details of your assignment.

Proceed with the payment

Choose the payment system that suits you most.

Receive the final file

Once your paper is ready, we will email it to you.

Our Services

No need to work on your paper at night. Sleep tight, we will cover your back. We offer all kinds of writing services.

Essays

Essay Writing Service

No matter what kind of academic paper you need and how urgent you need it, you are welcome to choose your academic level and the type of your paper at an affordable price. We take care of all your paper needs and give a 24/7 customer care support system.

Admissions

Admission Essays & Business Writing Help

An admission essay is an essay or other written statement by a candidate, often a potential student enrolling in a college, university, or graduate school. You can be rest assurred that through our service we will write the best admission essay for you.

Reviews

Editing Support

Our academic writers and editors make the necessary changes to your paper so that it is polished. We also format your document by correctly quoting the sources and creating reference lists in the formats APA, Harvard, MLA, Chicago / Turabian.

Reviews

Revision Support

If you think your paper could be improved, you can request a review. In this case, your paper will be checked by the writer or assigned to an editor. You can use this option as many times as you see fit. This is free because we want you to be completely satisfied with the service offered.