Question

Using common LISP, write a program that will calculate the area of a regular hexagon (polygon...

Using common LISP, write a program that will calculate the area of a regular hexagon (polygon that is equilateral).

will rate ASAP! thank you!
0 0
Add a comment Improve this question Transcribed image text
Answer #1

if the answer helped you please UPVOTE and if you have any doubts please COMMENT I will surely help.

The area of a regular hexagon with side length a is  \frac{3\sqrt{3}}{2} a^2 = 2.599 \times a^2

Code:

php6t34MQ.png

Output:

phpZ9DqOE.png

if the answer helped you please upvote and if you have any doubts please comment i will surely help.

Code:

; define a function HexagonArea to find the area of a hexagon
(defun HexagonArea()

; Take input from the user for the side length
; and set that to a variable called side
(princ "Enter side length of the hexagon: ")
(setq side (read))

; calculate area as 2.599 * area * area
(setq area (* 2.599 side side))

; Now print the area of the hexagon
(princ "Area of regular hexagon: ")
(write area))

; call the function to calculate the area
(HexagonArea)

Add a comment
Know the answer?
Add Answer to:
Using common LISP, write a program that will calculate the area of a regular hexagon (polygon...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • A regular polygon is an n-sided polygon in which all sides are of the same length...

    A regular polygon is an n-sided polygon in which all sides are of the same length and all angles have the same degree (i.e., the polygon is both equilateral and equiangular). The formula for computing the area of a regular polygon isArea =Here, s is the length of a side. Write a program that prompts the user to enter the number of sides and their length of a regular polygon and displays its area. Here is a sample run:

  • //include comments Opts (Regular polygon) An n-sided regular polygon has n sides of the same length...

    //include comments Opts (Regular polygon) An n-sided regular polygon has n sides of the same length and all angles have the same degree (i.e., the polygon is both equilateral and equiangular). Design a class named RegularPolygon that contains: Aprivate int data field named n that defines the number of sides in the polygon with default value 3. A private double data field named side that stores the length of the side with default value 1. A private double data field...

  • Using the idea of inheritance and polymorphism write a C++ program that calculates the area of...

    Using the idea of inheritance and polymorphism write a C++ program that calculates the area of regular polygons. This is a typical output when the desired program is executed: >> please enter the sides of your polygon: 3,4,5 >> Your polygon is a triangle and its area is: 6 In your program, you must check that the values entered are correct and can build a polygon. The number of the digits entered initially can help software to determine the polygon...

  • (Geometry: n-sided regular polygon) An n-sided regular polygon’s sides all have the same length and all...

    (Geometry: n-sided regular polygon) An n-sided regular polygon’s sides all have the same length and all of its angles have the same degree (i.e., the polygon is both equilateral and equiangular). Design a class named RegularPolygon that contains: ■ A private int data field named n that defines the number of sides in the polygon. ■ A private float data field named side that stores the length of the side. ■ A private float data field named x that defines...

  • MATLAB Write a function that calculates the area of a regular polygon if given the numbers...

    MATLAB Write a function that calculates the area of a regular polygon if given the numbers of sides and length of a side.

  • G area of a regular polygon - X DeltaMath * DEIXL Math, Language Arts X TH...

    G area of a regular polygon - X DeltaMath * DEIXL Math, Language Arts X TH Student Functions/Interface/acellus_engine.html?Classid=323622968 Translate G Home Schoology New folder Schoology Areas of Regular Polygons Find the area of a regular hexagon with a side length of 6 cm and an apothem of approximately 5.2 cm. Area = [?] cm2 Enter a decimal rounded to the tenths place. Enter cellus Corporation. All Rights Reserved. MacBook

  • Problem 2 9.9 Geometry: n-sided regular polygon pg. 362 (25 points) Follow instructions as provided on...

    Problem 2 9.9 Geometry: n-sided regular polygon pg. 362 (25 points) Follow instructions as provided on page 362, reprinted below 9.9 (Geometry: n-sided regular polygon) In an n-sided regular polygon, all sides have the same length and all angles have the same degree (i.e., the polygon is both equilateral and equiangular) Design a class named RegularPolygon that contains A private int data field named n that defines the number of sides in the polygon with default value of 3 A...

  • C++ program

    A regular polygon is an n-side polygon in which all sides are of the same length and all angles have the same degree(i.e., the polygon is both equilateral and equiangular). The formula for computing the area of a regular polygon isHere, s is the length of a side. Write a program that prompts the user to enter the number of sides and their length of a regular polygon and displays its area. 

  • Write a program that displays a convex regular polygon with m or n sides, where m...

    Write a program that displays a convex regular polygon with m or n sides, where m is the last digit of your student number plus 3, n is the second last digit plus 3. Use two buttons named “before” and “after” to change the number of sides of the polygon. Click on “before” button will show a convex regular polygon with m sides and click on “after” will show a convex regular polygon with n sides. For example, a student...

  • Write the code in LISP that define a function(named area-circle) that would calculate (return) the area...

    Write the code in LISP that define a function(named area-circle) that would calculate (return) the area of a circle when the radius of the circle is given as an argument. The function should be able to be called as follows (area-circle 10)

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT