From Wikipedia (https://en.wikipedia.org/wiki/Decimation_(punishment)): In the military of ancient Rome, decimation was a form of military discipline...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
From Wikipedia (https://en.wikipedia.org/wiki/Decimation_(punishment)): In the military of ancient Rome, decimation was a form of military discipline in which every tenth man in a group was executed by members of his cohort. A cohort (roughly 480 soldiers) selected for punishment by decimation was divided into groups of ten. Each group drew lots, and the soldier on whom the lot of the shortest straw fell was executed by his nine comrades, often by stoning, clubbing, or stabbing. Let's write a program that will simulate the decimation of a population. Decimation does not have to be 1 in 10 ( 10 % of the population). It could be 1 in 8 (12.5% of the population) or 1 in 12 (8.3% of the population). In our simulation, we will let the user decide the amount to reduce the population by. You will need to write 2 methods. 1. displayArray(): this method takes as parameters the populationarray and reduction ratio X and then will print out the contents of the array in rows of the appropriate length (if the reduction 10%, then it is reduced by 1 in 10, so it should be displayed in rows of 10 elements. If the reduction is 14%, then it is 1 in 7, so it should be displayed in rows of 7 elements. Hint: Use integer division to do this, you cannot have partial elements). Its signature should be: public static void printArray (int[] orgArray, int reduce By) 2. myDecimator(): This method will "kill" 1 element in each group by setting its value to 0. The parameters passed are the array and the reduction integer (the X in the 1 in X reduction ratio). The method should remove a random element from each reduction block by replacing the contents of the randomly chosen element with O. (Arrays are always passed by reference, so there is nothing to return, you do not need a second array). It's signature should be: public static void myDecimator(int[] orgArray, int reduceBy). The process the program should implement is: 1. Prompt the user for the size of the population to decimate, and what percentage to reduce the population by. Input this as a double and use it to calculate your X. 2. Create an array of the entered population size and populate it with random positive integer numbers 1-99. 3. Display the message "The array before a 1 in X reduction", where X is the denominator in the reduction ratio. 4. Call your display Array() method to display the population array formatted into rows of length x. Each of these rows is a block that will have an element "killed" by our decimation method. 5. Call MyDecimator(): 6. Display the message "The Array after a 1 in X reduction" From Wikipedia (https://en.wikipedia.org/wiki/Decimation_(punishment)): In the military of ancient Rome, decimation was a form of military discipline in which every tenth man in a group was executed by members of his cohort. A cohort (roughly 480 soldiers) selected for punishment by decimation was divided into groups of ten. Each group drew lots, and the soldier on whom the lot of the shortest straw fell was executed by his nine comrades, often by stoning, clubbing, or stabbing. Let's write a program that will simulate the decimation of a population. Decimation does not have to be 1 in 10 ( 10 % of the population). It could be 1 in 8 (12.5% of the population) or 1 in 12 (8.3% of the population). In our simulation, we will let the user decide the amount to reduce the population by. You will need to write 2 methods. 1. displayArray(): this method takes as parameters the populationarray and reduction ratio X and then will print out the contents of the array in rows of the appropriate length (if the reduction 10%, then it is reduced by 1 in 10, so it should be displayed in rows of 10 elements. If the reduction is 14%, then it is 1 in 7, so it should be displayed in rows of 7 elements. Hint: Use integer division to do this, you cannot have partial elements). Its signature should be: public static void printArray (int[] orgArray, int reduce By) 2. myDecimator(): This method will "kill" 1 element in each group by setting its value to 0. The parameters passed are the array and the reduction integer (the X in the 1 in X reduction ratio). The method should remove a random element from each reduction block by replacing the contents of the randomly chosen element with O. (Arrays are always passed by reference, so there is nothing to return, you do not need a second array). It's signature should be: public static void myDecimator(int[] orgArray, int reduceBy). The process the program should implement is: 1. Prompt the user for the size of the population to decimate, and what percentage to reduce the population by. Input this as a double and use it to calculate your X. 2. Create an array of the entered population size and populate it with random positive integer numbers 1-99. 3. Display the message "The array before a 1 in X reduction", where X is the denominator in the reduction ratio. 4. Call your display Array() method to display the population array formatted into rows of length x. Each of these rows is a block that will have an element "killed" by our decimation method. 5. Call MyDecimator(): 6. Display the message "The Array after a 1 in X reduction"
Expert Answer:
Related Book For
A Concise Introduction to Logic
ISBN: 978-1305958098
13th edition
Authors: Patrick J. Hurley, Lori Watson
Posted Date:
Students also viewed these programming questions
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Managing Scope Changes Case Study Scope changes on a project can occur regardless of how well the project is planned or executed. Scope changes can be the result of something that was omitted during...
-
Hi there , I need help. for my work i need a relevant and well written introduction as well as conclusion to the following below. My work is complete i just need a introduction and conclusion please...
-
A Styrofoam slab has thickness h and density ps. When a swimmer of mass m is resting on it, the slab floats in fresh water with its top at the same level as the water surface. Find the area of the...
-
Og is the leader of the surprisingly mathematically advanced, though technologically run-of-the-mill, Calm Waters caveman tribe. He must decide on the number of stone clubs and stone axes to be...
-
An electric utility is considering a photovoltaic (PV) solar panel system to provide power to water conditioning pumps within the power plant. The project will be done in two phases. Phase 1 has an...
-
The cash flows associated with a project are shown below. The interest rate varies from year to year as shown. Determine an equivalent uniform annual series of cash flows. EOY Cash Flow Interest...
-
Lansbury Company purchases equipment on January 1, Year 1, at a cost of $518,000. The asset is expected to have a service life of 12 years and a salvage value of $50,000. (a) Compute the amount of...
-
Plot the exchange rate of US dollars against 3 other foreign currencies in separate figures from December 1st, 2019 to February 28th, 2023. Note: the exchange rate is defined as how much foreign...
-
McLennon Company had an Accounts Receivable balance of $320,000 and a credit balance in Allowance for Uncollectible Accounts of $16,700 at January 1, 2014. During the year, the company recorded the...
-
In 1994, Jeff Bezos decided to create a new start-up, an online bookstore. He received an initial equity financing support from his family for 250,000 and a loan from the bank for 50,000. The...
-
What is the beta of a stock that begins with the same letter as your first name? What is the beta of a stock that begins with the same letter as your last name? Why is it so common to use historical...
-
Uncharged ammonia [NH3(aq)] is toxic to fish at a concentration of 0.01 mg/L NH3-N. What is the maximum concentration (mg/L) of total ammonia nitrogen (the sum of the N concentrations in NH3 and...
-
Tina (aged 52) was seriously injured and unable to return to work. She had a superannuation balance of $250,000 with a tax-free component of $12,500. Due to her injury, she was also paid a disability...
-
How does industrialization fundamentally alter the economic structure of societies, transitioning from agrarian-based economies to industrialized ones?
-
Ameen owns all of the shares of XYZ Ltd, which has a December 31 year end. Ameen also works as an employee in the business full time. When Ameen first started XYZ, they set up a policy whereby any...
-
Suppose that the factory claims that the proportion of ball bearings with diameter values less than 2.20 cm in the existing manufacturing process is the same as the proportion in the new process. At...
-
Modify the CYK algorithm so that it applies to any CFG, not just those in CNF.
-
In the following symbolized arguments, derive the line needed to obtain the conclusion (last line), and supply the justification for both lines.
-
When possible, compute the truth values of the simple components in the following compound propositions. If no truth value can be computed, write a question mark (?) under the letter or letters with...
-
Contrary to the tales of some scuba divers, the toothy, gaping grin on the mouth of an approaching shark is not necessarily anticipatory. It is generally accepted that by constantly swimming with its...
-
A landlord appeals and a tenant cross-appeals a district court ruling affirming in part and reversing in part a small claims court decision in a residential landlordtenant dispute. This is a case...
-
Norman Eastwood owns and lives in a single-family home with his wife (the Property). The Property is located in the Willow Bend Lakes Community in Plano, Texas. The Willow Bend Lakes Community is...
-
20 East 67th Street Associates LLC (Landlord) is the owner of a seven-story residential property located at 20 East 67th Street in Manhattan, New York (the Property). On January 2, 2019, Emily Jerome...
Study smarter with the SolutionInn App