1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Harman [31]
3 years ago
8

Write a method that takes a RegularPolygon as a parameter, sets its number of sides to a random integer between 10 and 20 inclus

ive, 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.
Computers and Technology
1 answer:
Sergio [31]3 years ago
5 0

Answer:

import java.lang.Object

import java.lang.Math

public class RegularPolygon  extends java.lang.Object{

  public void randomize(RegularPolygon c){

       int min = 10, max1 = 20;

       double  min1 = 5, max1 = 12;

       double range = (max - min) + 1;

       double range1 = (max1 -min1) + 1

       int side = (Math.random() * range) + min;

       double len = (Math.random() * range1) + min1;

       c.setNumSides(side);

       c.setSideLength( len);

 }

 public static void main(String[] args) {

    RegularPolygon r = new RegularPloygon();

    randomize(r);

 }

}

Explanation:

The randomize method accepts a regular polygon class as its only parameter and assigns a random number of sides and the length of these sides with the 'Math.random' function.

You might be interested in
A(n) ________ is a specific type of computer program that manages all programs on a computer.
Oksi-84 [34.3K]
A kernel manages the whole computer including hardware. In Unix, all processes are launched from systemd/launchd.
4 0
3 years ago
What are motion graphics?
AysviL [449]
D)Animated abstract shapes
3 0
3 years ago
What parts of the computer does it not need to function?​
Thepotemich [5.8K]
Fancy lights, mouse, keyboard, you can do fan but the computer will eventually overheat, it need coolant for it to run for a long while
6 0
3 years ago
What Is an Antivirus?
wariber [46]
Antivirus software, or anti-virus software, also known as anti-malware, is a computer program used to prevent, detect, and remove malware. Antivirus software was originally developed to detect and remove computer viruses, hence the name.
8 0
3 years ago
Read 2 more answers
Which types of customizing can you do with the Cell Style galleries? Check all that apply.
guapka [62]

Change the font size

Change the font color

Change the background color

Adjust percentage of background shade

Add a hyperlink

Explanation:

All of these have todo with style

8 0
3 years ago
Read 2 more answers
Other questions:
  • Why will the standard replacement algorithms (LRU, FIFO, clock) not be effective in handling this workload for a page allocation
    11·1 answer
  • In order to be compliant with the NIST publications, policies must include key security control requirements. One of these key r
    10·1 answer
  • What are examples of some Exotic currencies?
    14·1 answer
  • Justin Blake and Raegan Beast anyone?? I miss Jaegan a ton and I need a fangirl to talk to.
    13·1 answer
  • In most software packages, the function key F1 is used to run the _____program.
    10·1 answer
  • For each entity, select the attribute that could be the unique identifier of each entity.
    12·1 answer
  • assume an int array, candy, stores the number of candy bars sold by a group of children wherecandy[j] is the number of candy bar
    7·2 answers
  • A home user reports to a network technician that the Internet is slow. The network administrator discovers that multiple unknown
    12·2 answers
  • Justify any FOUR significant factors to remember when installing your motherboard
    7·1 answer
  • Explain the term creating in word processing​
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!