Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

in HTML - Create a Shape class with three properties: name, sides, and sideLength. - Add a constructor to this class. The constructor takes arguments

in HTML
image text in transcribed
- Create a Shape class with three properties: name, sides, and sideLength. - Add a constructor to this class. The constructor takes arguments for the name, sides, and sideLength properties, and initializes them. - Add a new method calcPerimeter() method to the class, which calculates its perimeter (the length of the shape's outer edge) and logs the result to the console. - Create a new instance of the Shape class called square. Give it a name of square and a sideLength of 5. - Call your calcPerimeter0 method on the instance, to see whether it logs the calculation result to the browser's console as expected. - Create a new instance of Shape called triangle, with a name of triangle and a sideLength of 3 . - Call triangle.calcPerimeter( to check that it works fine. Aid: https://www.codecademy.com/forum_questions/55a1697476b8fee1ec000154

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Hands-On Database

Authors: Steve Conger

2nd Edition

0133024415, 978-0133024418

More Books

Students also viewed these Databases questions

Question

=+analysis, and social media communication audit

Answered: 1 week ago