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
Describe some of the moral, ethical, and legal issues surrounding responsible use of technology (and the information obtained th
rosijanka [135]

Answer:

Technology must be used in the right manner, and for the right purposes. When the latest in image processing is used to find a new planet through machine learning, we are right. However, when we kill somebody with a gun, we are not right. The bullet can be directed to legs rather than heart, and with continuous love and affection, any heart can be won. Sometimes this is allowed legally, Also it can be ethically correct as some institutions might allow it ethically, and it can be for some morally right as well. However, still, this is not right for some, and that is the almighty. And it's hard to match him morally or ethically. And for him nothing wrong is legal. Coming back to the use of technology in the workplace, you will find that you must follow the ethics of that institution, and your moral value must always be subsidiary to their ethics. And in the 21st century, and particularly in developed domains you will never be asked to sacrifice your moral value, and by the end of next quarter, this might be true for the whole world. Hence, ethics and moral values by then can in all cases be used interchangeably, However, when it comes to being legal, your institution will let you know all the laws, and you need to follow them, and these are applicable to all the institutions, and hence you need not require to sacrifice anything for being legal. Always remember that in the 21st century, you might see some very lethal technologies, and your job in the workplace is to study those technologies with your fullest potential. Issues will arise if you do not work with your fullest potential. And if you will, your moral value will be respected, and you will be easily able to obey their ethics, as no company ever think about even a little bad for their employees. And legally even the director is required to be correct just like you. And what is legal is being decided by the court and not any company. Hence, always try to work with your fullest potential, and never think to harm anybody, or your company. If you do this, you will be the hero of your company very soon.

Explanation:

And remember, the information that you get to know in your company is confidential, and you should not leak it to anybody, and even your relatives. Always keep them hidden inside you, and never ever try to leak them.

3 0
3 years ago
Can anyone gift me the gold membership on nitro type plz my name is Yuta hibiki lame If you cant then thats ok
denis23 [38]
No... ty for the pts tho
5 0
3 years ago
Read 2 more answers
I will give brainyest
STALIN [3.7K]

Answer:

Try charging battery for 25 minutes before attempting to power the Dell Chromebook system on. If the battery still won't charge, attempt to reset the EC. To do this, first shut the unit down and then press and hold the 3-key combination of ESC+ROUND ARROW+POWER.

8 0
2 years ago
Read 2 more answers
Assume that we have seeded a program with 5 defects before testing. After the test, 20 defects were detected, of which, 2 are fr
melamori03 [73]

Answer:

see explaination

Explanation:

Given that we have;

Defects before testing = Defects planted = 5

Defects after testing = 20

Seeded defects found = 2

Real, non seeded defects = 18

Hence, Total number of defects = (defects planted / seeded defects found) * real, non seeded defects = (5/2)*18 = 45

Therefore, Estimated number of real defects still present = estimated total number of defects - number of real, non seeded defects found = 45-18 = 27

5 0
3 years ago
What best describes the relationship between short and long term goals?
daser333 [38]

Answer: you set your mind on doing something they are both goals.

Explanation:

8 0
3 years ago
Read 2 more answers
Other questions:
  • a particular variety of database that works by connecting tables to each other. It is the most popular form of database and the
    13·1 answer
  • What is the decimal number 75 in binary and hexadecimal?
    8·1 answer
  • A database interrogation is a major benefit of the database management approach, where end users can query (“ask”) the database
    6·1 answer
  • A network technician is assisting the security team with some traffic captures. The security team wants to capture all traffic o
    9·1 answer
  • What would happen if the two pith balls shown in the figure above were held together for a few moments, then released?
    6·1 answer
  • Set-In-Order includes making changes to the layout of the area.A) TrueB) False
    12·1 answer
  • What is the name of this tool and what can it be used for?<br> Thanks!!
    7·1 answer
  • Complete the second clause of the following Prolog program for member/2 where member(X, Y) checks whether X is an element (a mem
    7·1 answer
  • Write a python program that requests a positive integer from the user, determines if it is a composite, a prime or neither prime
    8·1 answer
  • losing sight of piecemeal progress: people lump and dismiss improvement efforts that fall short of categorical change—despite im
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!