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
IrinaK [193]
2 years ago
13

Edhesive unit 2 lesson 5 coding activity 1 Write code which creates three regular polygons with 11, 14 and 19 sides respectively

. All side lengths should be 1.0. The code should then print the three shapes, one on each line, in the order given (i.E. The one with 11 sides first and the one with 19 sides last). Sample run: regular hendecagon with side length 1.0 regular tetrakaidecagon with side length 1.0 regular enneadecagon with side length 1.0
Computers and Technology
1 answer:
SVEN [57.7K]2 years ago
4 0

Answer:

public class Polygon {

   private String name;

   private int sides;

   private double sideLength;

   public Polygon(String name, int sides, double sideLength) {

       if (sideLength <= 0) throw new IllegalArgumentException("Length cannot be zero or negative.");

       if (sides <= 0) throw new IllegalArgumentException("Sides cannot be zero or negative.");

       this.name = name;

       this.sides = sides;

       this.sideLength = sideLength;

   }

   public String getName() {

       return name;

   }

   public void setName(String name) {

       this.name = name;

   }

   public double getSideLength() {

       return sideLength;

   }

   public void setSideLength(double sideLength) {

       if (sideLength <= 0) throw new IllegalArgumentException("Length cannot be zero or negative.");

       this.sideLength = sideLength;

   }

   public int getSides() {

       return sides;

   }

   public void setSides(int sides) {

       this.sides = sides;

   }

   (use the at sign here)Override

   public String toString() {

       return "regular " + name + " with side length " + String.format("%.1f", sideLength);

   }

}

public class TestPolygon {

   public static void main(String[] args) {

       Polygon sides11 = new Polygon("hendecagon", 11, 1);

       Polygon sides14 = new Polygon("tetrakaidecagon", 14, 1);

       Polygon sides19 = new Polygon("enneadecagon", 19, 1);

       System. out. println(sides11);

       System. out. println(sides14);

       System. out. println(sides19);

   }

}

Explanation:

This java source code defines a class that creates a regular polygon based on the number of sides given to it.

Below is a screenshot of the program code and output.

You might be interested in
What number system do people in America use?
Sindrei [870]

Answer:

Base-10 (decimal)

Explanation:

8 0
3 years ago
Read 2 more answers
The Zoom slider will allow users to _____.
NeX [460]
The Zoom slider will allow users to change the way the document appears on the screen
3 0
3 years ago
Read 2 more answers
Indentation is useful to make the document easier to read. To increase the indentation of the paragraph, you press the increase
jeka94

Answer:

The correct answer to this question is given below in the explanation section.

Explanation:

The correct answer is Home.

Indentation is useful to make the document easier to read. To increase the indentation of the paragraph, you press the increase indentation in the   <u>Home</u> tab.

you can increase/ decrease indentation in Home tab under the Paragraph groups of command.

Othe options are not correct because:

View tab has settings related to how the document looks like. Insert tab has settings related to the insertion of image, shape, pages, tables, illustration, and links, etc into a document. The review tab allows you to review the document with different available settings.

4 0
3 years ago
Which loan type requires you to make loan payments while you’re attending school?
Levart [38]
<span>A:Unsubsidized federal loan</span>
7 0
3 years ago
Define graphics packaging​
Sav [38]

Answer:

"A graphics package is an application that can be used to create and manipulate images on a computer. There are two main types of graphics package: painting packages."

Explanation:

i looked it up like a normal person

jeez does nobody use google on here lol

4 0
3 years ago
Other questions:
  • Please answers the questions 1-15
    6·1 answer
  • Write a recursive function, replace, that accepts a parameter containing a string value and returns another string value, the sa
    5·1 answer
  • There are three types of value for money. Which of the following is not a method of value?
    14·1 answer
  • What does it mean to read visual and audio text
    7·1 answer
  • Special effects are added using the _____.
    16·1 answer
  • Write a repetition statement that outputs the numbers 45 , 51 , . . . , 165 . That is, all of the multiples of 6 in increasing o
    7·1 answer
  • Complete this assignment in Python 3.x. Make sure you have downloaded the software, and it is installed correctly.
    10·1 answer
  • Clasifica los documentos comerciales en activo, pasivo o patrimonial para cada operacion:
    14·1 answer
  • I am a non-volatile type of built-in memory. I store my contents long-term. My job is to store critical programs that the comput
    14·1 answer
  • In what way, if any, are problems related to conflicts? Problems and conflicts are the same thing. Problems and conflicts are th
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!