Write a method that takes a Regular Polygon as a parameter, sets its number of sides to a random integer between 10 and 20 inclusive, and sets its side length to a random decimal number greater than or equal to 5 and less than 12. Use Math.random() to generate random numbers. This method must be called randomize() and it must take a Regular Polygon perimeter.

Answers

Answer 1

Answer:

Answered below

Explanation:

//Program is written in Java programming language

Class RegularPolygon{

int sides = 0;

int length = 0;

}

public void randomize(RegularPolygon polygon){

int randomSides = (int) 10 + (Math.random() * 20);

double randomLength = 5 + (Math.random() * 11);

polygon.sides = randomSides;

polygon.length = randomLength;

}


Related Questions

Other Questions
Brazil is the largest country in South America. Which European power claimed most of that territory as part of its empire? what is 18/7 reduced to the lowest term How does the sonnet structure of this poem contribute to its overall meaning?A) The first stanza sets up a problem and the second stanza solves it.B) The first stanza sets a humorous tone and the second stanza proves more serious.C) The first stanza sets up a scene and the second stanza clarifies the deeper meaning D) The first stanza sets a mournful tone and the second stanza offers hope and redemption what is the y intercept of the points (2,72) and (5,162) Help pls 6th grade math i will give brainliest What conflict broke out in Nigeria after independence was declared? You win a lottery that pays $10,000 each year for the next 5 years beginning next year. How much are your winnings worth today Commandancy of the Alamo Bejar, Feby. 24, 1836 To the People of Texas & All Americans in the World Fellow citizens & compatriots I am besieged by a thousand or more of the Mexicans under Santa Anna ... I call on you the name of Liberty, of patriotism & everything dear to the American character, to come to our aid, with all dispatch ... If this call is neglected, I am determined to sustain myself as long as possible & die like a soldier who never forgets what is due to his own honor & that of his country: VICTORY OR DEATH. -William Barret Travis, Lt. Col. comdt. 3. Which statement best expresses the main idea of the letter above A. The volunteers in the Alamo strongly support the declaration of independence.B. The defenders of the Alamo plan to fight the mexican army, but are willing to surrender if the fight becames too fierce.C. divine authority is on the side of the defenders of the Alamo, and will easily defeat the Mexican army surrounding themD. The Texans at the alamo need reinforcements in order to defeat themselves against a much larger Mexican force, but will fight to the death. HELP URGENT WILL GIVE BRAINLIEST Ra2 of 12Savings AccountAlexandra deposits $600 in her bank account. Theaccount earns interest at a rate of 5%, compoundedannually.Which equation below represents Alexandra's savingsif she makes no additional deposits or withdrawals? which two whole number is 15/4 between? LOOK AT PICTURE how much work is done when a girl pushes a lunch cart 15m across the cafeteria with a force of 3N explain why the graph of [tex]y=2x^{2} +4x-k+1[/tex] has no x-intercepts when k=-5 Solve this equation:5x^4+ 50x^2 +80=0 a glass of organge juice contains .85dl of juice. how many millimeters of orange juice is that At a sports car rally, a car starting from rest accelerates uniformly at a rate of 5 m/s/s over a straight-line distance of 291 m. How long (in seconds) did it take the car to travel the 291 m Solve for x and show your work.2x+1=-3-3x+2=6x+72n-4+4n=6-n-3(3x-5)+2=2x Will give brainliestRead this excerpt from The Miracle Worker.ANAGNOS: . . . It will no doubt be difficult for you there, Annie. But it has been difficult for you at our school too, hm? Gratifying, yes, when you came to us and could not spell your name, to accomplish so much here in a few years, but always an Irish battle. For independence.(He studies ANNIE, humorously; she does not open her eyes.)This is my last time to counsel you, Annie, and you do lack some by some I mean all what, tact or talent to bend. To others. And what had saved you on more than one occasion here at Perkins is that there was nowhere to expel you to. Your eyes hurt?ANNIE: My ears, Mr. Anagnos.(And now she has opened her eyes; they are inflamed. Vague, slightly crossed, clouded by the granular growth of trachoma, and she often keeps them closed to shut out the pain of light.)ANAGNOS [SEVERELY]: Nowhere but back to Tewksbury, where children learn to be saucy. Annie, I know how dreadful it was there, but that battle is dead and done with, why not let it stay buried?Which of these statements provides the best summary of the scene?Anagnos notices that Annies eyes are closed, and he discusses her life in Tewksbury and her time at Perkins.Anagnos praises Annies work at Perkins and mentions her previous time in Tewksbury, a town on the Ipswich River.Anagnos is cruel as he expresses doubts about Annies ability to leave Perkins and begin teaching.Anagnos describes Annies progress at Perkins and her strong will, and he expresses concerns about her attitude. PLEASE HELP ASAP I suck at math :( will give brainiest. thx can someone help me im not timed