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]
3 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]3 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
Describe network in terms of the class computer lab
Pani-rosa [81]
<span>A group of interconnected devices around the world.</span>
7 0
3 years ago
Think of some local businesses that have websites. Look online and identify two different websites for businesses or services in
GenaCL600 [577]

Explanation:

Professional service-based businesses are well suited for the Internet, because the primary services they provide are information-based. A housecleaning or lawn care service business is not suited well for the Internet because the delivery of those services requires the provider to be physically present.

7 0
2 years ago
With the ease of the Internet, it is not uncommon for individuals to copy skills from resume templates to make themselves look m
Butoxors [25]

Answer:

Content.

Explanation:

With the convenience of the Web, copying skills of resumes models is not unusual among people that create themselves seem quite appealing to such a recruiter. Understanding this, Ed developed a check to examine whether that person's job skills are about what's on the form.  

He is checking the validity of the content because It relates to that of the extent that the products on such a survey seem to be extremely determinative of the whole domain to be measured by the study.

7 0
4 years ago
What is the purpose of an arraignment?
IgorC [24]

Answer:

At an arraignment, the court officially illuminates a litigant regarding charges contained in a prosecution or data, gives the respondent a duplicate of the charging instrument, and takes the litigant's response to those charges as a request.

Explanation:

5 0
3 years ago
Read 2 more answers
A column letter above the grid, also called the ____, identifies each column.
Nostrana [21]

I guess the answer in the blank is Column Heading.

A column letter above the grid, also called the column heading, identifies each column.

8 0
3 years ago
Other questions:
  • HELP PLEASE
    7·2 answers
  • Some cases have ____, also called spacers, which are round plastic or metal pegs that separate the motherboard from the case, so
    9·1 answer
  • I have tried installing "windows media player" on my computer but at a point, something disrupts its instalment or I am asked to
    7·1 answer
  • What are three requirements of information technology a. Accuracyb. _______________________________c. __________________________
    13·1 answer
  • You recently started working part-time in a retail store, and are learning about the reading devices your store uses. Your store
    10·1 answer
  • Circular error are caused by adding the cell name of a/an cell to aformula
    7·1 answer
  • Is anyone a robIox moderator?
    13·2 answers
  • How do you code to find the surface area 6 s2, volume s3 in python
    6·1 answer
  • To find detailed information about the origin of an email message, look at the ________________.
    11·1 answer
  • What is software?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!