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
Write a program for TIC TAC TOE in PYTHON
masya89 [10]

Answer: much too long to write here: see attached

Explanation:

3 0
3 years ago
What is remote assistance?
Slav-nsk [51]

Answer:

Quick Assist, Windows 10 feature, allows a user to view or control a remote Windows computer over a network or the Internet to resolve issues without directly touching the unit. It is based on the Remote Desktop Protocol.

Explanation:

.....

3 0
3 years ago
A(n) ______ database stores data in tables that consist of rows and columns.
melisa1 [442]
The answer is a spreadsheet.
4 0
3 years ago
Read 2 more answers
The following image shows the number of orders Company A received in 2015-2020. A financial analyst wants to calculate the year-
abruzzese [7]

The step that the analyst take to apply the same formula to all adjacent years using the Macabacus’ Fast Fill Right shortcuts  is the use of the  Macabacus Excel Add-in.

<h3>What are the feature in the Formulas menu of the Macabacus Excel add-in?</h3>

The Macabacus Excel Add-in is known to be a formula auditing tools that aids  one to be able to know and correct any kinds of errors and other forms of inconsistencies in the financial models.

Note that it is one that tends to bring up the speed of the modeling process. The Excel add-in is a tool that aid the users to make some reliable links between the financial model and that of the PowerPoint or Word documents.

Hence, The step that the analyst take to apply the same formula to all adjacent years using the Macabacus’ Fast Fill Right shortcuts  is the use of the  Macabacus Excel Add-in.

Learn more about Macabacus from

brainly.com/question/1538272

#SPJ1

8 0
1 year ago
If your computer is running slowly, which of the following is most likely to solve the problem?
Rufina [12.5K]
One of the easiest fixes is going to be running a scan of it.  It could be malware, or even a virus slowing it down.  If nothing comes up, cleaning it out with a can of air is the next best solution.  Dust is very bad for a computer and it can cause it to overheat and/or slow down.  While you are cleaning it out, go ahead and make sure all the cords are plugged in.  However, if your computer runs slowly, but it works, it probably isn't the cords.  That's what I would do.  
5 0
3 years ago
Read 2 more answers
Other questions:
  • A network protocol is a set of rules defining communication between two devices. True False
    8·2 answers
  • Which step of the design process is the company currently engaged
    15·1 answer
  • Componets of computer
    5·1 answer
  • What advantage does a circuit-switched network have over a packet-switched network? What advantages does TDM have over FDM in a
    6·1 answer
  • Write four overloaded methods called randomize. Each method will return a random number based on the parameters that it receives
    5·2 answers
  • What is distribution hardware?
    14·1 answer
  • What does a page break do?
    13·1 answer
  • How does this happen on brainly????
    12·2 answers
  • How ict tools changed the way we live explain it​
    12·1 answer
  • Computers rarely make mistakes. True or false
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!