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
Use of the internet to access programs and data on computers that’s are owned and managed by the other using large data centers.
Nimfa-mama [501]

Answer:

I just wanna learn how to code

Explanation:

6 0
3 years ago
If 10 ft lb of torque is applied at gear A, then what is the output torque at gear D?
Mrrafil [7]
This is actually simple math.
Use the formula of Gear A/Torque > 12.8ft/lb/10 > 1.28.
Therefor the output torque is 1.28 for gear D.
6 0
3 years ago
What does Pentium means?:/
netineya [11]
Pentium is just a brand of a CPU chips from Intel that is usually in your laptops or chromebooks. It's used for general purpose computing. Produced by Intel since 1993. 
4 0
3 years ago
Read 2 more answers
How do online note-taking tools support students’ academic goals? Check all that apply.
MakcuM [25]

Answer:

all but 3

Explanation:

3 is strange and I need points sorry

5 0
3 years ago
Read 2 more answers
What language used orthogonality as a primary design criterion?
pogonyaev
LIPS a functional language is one in which computations are made primarily by applying function to given program
4 0
3 years ago
Other questions:
  • Write a program that asks the user to input four numbers (one at a time). After the four numbers have been supplied, it should t
    6·1 answer
  • ______ is an example of unauthorized access to your computer or accounts.
    14·1 answer
  • You specify the shape of an oval in a Java applet by defining the oval's:__________.
    5·1 answer
  • When dealing with a person who is behaving violently you should argue with them. A. False B. True
    5·1 answer
  • Communication is defined as__________.
    10·1 answer
  • Write a function stats that takes an array and the number of elements in the array. Then, it computes and prints the minimum val
    8·1 answer
  • What are finger nails made of?-
    12·2 answers
  • Question 7 (True/False Worth 3 points)
    8·2 answers
  • Pie charts are best used for
    5·1 answer
  • Zoe wants to post something controversial online, but then she remembers that employers may look at her social media when she st
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!