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
The numbers on the bottom of a typical check represent all of the following EXCEPT?
vfiekz [6]
The amount of money in your account
8 0
3 years ago
Read 2 more answers
list the sixth external parts of a computer system and identify which are output and which are input devices
Marianna [84]
<em>Keyboard -----> Input device</em>
<em>Printer  --------> Output device</em>
<em>mouse ---------> Input device</em>
<em>Monitor --------> Output device</em>
<em>CD roam ------> Input device</em>
<em>Projector ------> Output device</em>
4 0
3 years ago
Read 2 more answers
How many spaces is equal to one tab on a keyboard? When I compose emails, the tab button doesn't indent for me, so how many time
Ganezh [65]
You have to press the space bar 13 times in order to make it the same length as the tab.
6 0
4 years ago
How Oracle 12c advances the security discussion?
krok68 [10]

Answer: The oracle 12 c advances are given below.

Explanation:

The oracle 12 c provides the ability to tag the data with the label of data. It provides the classification to the data. This allows to check which data is sensitive and also allows the combination of sensitive data to be combined with the same table as the bigger data without compromising the security of the database.

8 0
4 years ago
g Write a user-defined MATLAB function for the following math function: y ( x )=(−.2 x 3 +7 x 2 )e −.3x The input to the functio
kolezko [41]

Answer:

Go to explaination for the step by step answer.

Explanation:

a)Code

function[y]=operation(x) % this function takes x as input and returns y as output

y=(-0.2*x^3+7*x^2)*exp(-0.3*x)

end

% call this function in command widow by typing operation(value of x) like shown in figure in the first attachment.

b. write a code of above function in one script window and save the code with same name as name of function that is name of script should be saved as operation.Now copy paste the below code in new script window and run the code

clc

clear all

x=-2:.1:6

n=length(x)

for i=1:1:n

a=x(i)

y(i)=operation(a)

end

plot(y,x)

xlabel('X')

ylabel('Y')

Please kindly check attachment for pictorial answers that supports the code.

4 0
3 years ago
Other questions:
  • If you need to reprogramming your gps after you begin driving __.
    15·2 answers
  • Data mining must usestatistics to analyze data.<br> True<br> False
    12·1 answer
  • Because it is important not to disrupt the normal business function, joint application design (JAD) sessions should be held at a
    11·1 answer
  • Having friends who cause you stress can decrease your happiness, which can in turn
    13·2 answers
  • Write a program to print the area of a rectangle by creating a class named 'Area' having two methods. First method named as 'set
    6·1 answer
  • Select the correct answer.
    14·1 answer
  • Activity 8. Direction: Read the article and make an outline. Be guided by the rubric for outlining. Write your answer on a separ
    15·1 answer
  • UCLA Extension's marketing department wants
    12·1 answer
  • One driving technique to increase fuel efficiency is.
    11·1 answer
  • Which of the cached information retrieved will be the same as what is stored in the original server where the data is maintained
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!