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

Answers

Answer 1

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.

Edhesive Unit 2 Lesson 5 Coding Activity 1 Write Code Which Creates Three Regular Polygons With 11, 14

Related Questions

WILL GIVE BRAINLIEST! The command simplify is used if you only want the first two digits of a decimal to appear in the interpreter.

true

false

Answers

Answer:

falsee?

Explanation:

Answer:

Yes its false i believe

Explanation:

What is the output?
class car:
model = "
age = 20
myCar = car()
myCar.age= myCarage + 10
print(myCarage)
Output:

Answers

Answer:

Following are the modified code to this question:

class car:#defining a class car  

   model = ""#defining a class

   age = 20#defining an integer variable that hold a value

myCar = car()#creating reference of class

myCar.age= myCar.age+ 10#Use reference to add value in age variable

print(myCar.age)#print age value

Output:

30

Explanation:

In the above code class care is defined, inside the car a string variable "model", and an integer variable "age" is defined that hold a value, in the next step, class reference myCar is defined, that used to add value in age variable an at the last we use print method to print age variable value.

Dora has inserted a text box into a Word document that she is formatting. Which strategy will not format text boxes? Create a link between two text boxes. Set the height and width of the text box. Add background images to the text box. Link the text box to another document.​

Answers

Answer:

D. Link the text box to another document.​

Explanation:

A text box is an object that you may add to your page that allows you to place and enter text wherever in it. The correct option is D.

What is a text box?

A text box is an object that you may add to your page that allows you to place and enter text wherever in it. Content boxes may be handy for attracting attention to a certain text and also for moving text about in your document.

Dora has inserted a text box into a Word document that she is formatting. Therefore, the strategy that will not format text boxes is strategy will not format text boxes.

Hence, the correct option is D.

Learn more about Text Box:

https://brainly.com/question/13812028

#SPJ2

Which of the following is an example of data an Earth-observing satellite would collect?
studying ocean and land changes

monitoring the movement of ships

tracking signals between different points on Earth

studying weather patterns

Answers

Answer:

A

Explanation:

Hopefully this helps

this is very simple i just need someone to type out this for me

Answers

Answer:

#27

2i , -2i, i, -i            i^2 = -1

1(x - 2i)(x + 2i) 1(x-i)(x+i)

x^2 +2x-2x -4.2i x^2 -xi-xi -i

(x^2 + 4)      x^4 + 1

x^2 +x^2 +11x

x^4 +5x^2 +4

+4+2+2+-1

*This was not simple for me

With _________, users will receive recommendations for items liked by similar users.

Answers

Answer:

Collaborative filtering

Explanation:

Collaborative filtering is an algorithms family in which there are various ways to determine the same users or items also there are various ways to determine the rating depending upon the same users rating

Therefore as per the given situation, the above is the answer

Hence, the same is to be considered

Sending the same messages to a large number of users is called​

Answers

Answer:

Can you give me the options

Which line of code will cause the loop to execute exactly one time?

for b in range(12, 12):
for b in range(12, 13):
for b in range(13, 13):
for b in range():

Answers

for b in range (12, 13)?

How many bit make a byte .​

Answers

Answer:

It is easy .8 bits.You have to note this

Answer: 8

1 byte = 8 bit

The image below shows an encoding for a black and white pixel image. The first two
bytes of the data (circled in red) are used to encode the width and height of the
image. What is the best term for this type of "data about the data"? Explain why it is
necessary to include this data in the encoding.

Answers

Answer:

where is the image i need the image

Explanation:

Your friend told you that your favorite celebrity couple split. What is the best media form to use?
a
Wiki
b
Social Network
c
Infotainment site
d
Forum

Answers

Answer:

b

Explanation:

I think social network is the first source of every update of reality even wiki gets info from social network

Answer:a)wiki

kalo salah maaf ya

Other Questions
i need help on this guys and plz help Complter avec la prposition correcte:1- Il vient .Londres.2- Vous travaillez .Bangkok Thalande.3- tes vous ..Pakistan ou Inde?4- Il y a de bons monuments Rome ..Italie.5- Elle est .Portugal.6- Nous voyageons Mumbai .avion mais nous allons lcole..vlo. Based on the tables below when do these two functions intersect? Write a short advertisement for a bar of soap, being as soothing as you can. Underline all the pleasantly connotative words you use. me pueden decir los tres generos en los que se divide el teatro plis Explain what contributes to an ecosystems stability? NEED THIS ASAP, ITS A FINAL!!! WILL MARK BRAINLIEST IF CORRECT.The following chart shows the amount of four different minerals found in lake water and in the cytoplasm of algae:Which mineral(s) did the algae uptake through active transport? Calcium and sodium Nitrogen and potassium Nitrogen only Potassium and sodium All the following are compounds except. A.water. B.sugar solution. C.aqueous. D.sulphur dioxide YOU GET 60 POINTS!! Ronald rents a car from Cheap Rent-a-Car for $25 plus $0.05 per mile. Dixon rents a car from Great Cars for $40 plus $0.03 per mile. How many miles must they both drive for their rental fees to be the same? add the correct semicolons commas or colons if needed Answer Please : ) Why negative ( - ) sign is cannot be pulled out of square root.??? Does anyone know the answer A particular engine has a power output of 5 kW and an efficiency of 30%. If the engine expels 6464 J of thermal energy in each cycle, find the heat absorbed in each cycle. Answer in units of J. what is 9 squared times 8 squared Sending Paypal to whoever gets this right ( i made this question) The scientific method can easily be misinterpreted as ___________. Question 1 options: a great magical trick, or slide of hands, rather than factual an "auto mechanics" guide to Science Investigation a "cookbook" recipe for performing scientific investigations the perfect method for finding the answers to all questions Titus works at a hotel. Part of his job is to keep the complimentary pitcher of water at least half full and always with ice. When he starts his shift, the water level shows 8 gallons, or 128 cups of water. As the shift progresses, he records the level of the water every 10 minutes. After 2 hours, he uses a regression calculator to compute an equation for the decrease in water. His equation is W 0.414t + 129.549, where t is the number of minutes and W is the level of water. According to the equation, after about how many minutes would the water level be less than or equal to 64 cups? 150 minutes160 minutes170 minutes180 minutes Which of there is a basic characteristic of a civilization?A) Strong military B) Written language C) Capitalist economyD) Democratic government PLEASE I NEED HELP!!!Using the table below, identify the unknown material that has a mass of 15,06 g and avolume of 0.78 mL.Substance Density (g/cm) SubstanceIce (0C) 0.917 Human fatWater (4.0C) 1.0000 CorkGold1931Table sugarHelium (25C)0.000 164 Balsa woodAir (25C) 0.001 185 EarthDensity (g/cm)0.940.22-0.261590.12554IceWaterGoldHeliumO Air How did the US respond to World War I?