In geometry, a hexagon is also a type of polygon with 6 sides. If the hexagon is regular, then the lengths of all the sides will be the same as well as all the angles will be equal. Clearly, the sides of a regular hexagon are congruent. To find out the area of a hexagon, it is first divided into small six isosceles triangles as shown in Figure 1. Then, the area of one of the triangles is calculated and then multiply by 6 to find the total area of the hexagon. 120° 60 Figure 1: Hexagon The area of a hexagon can be calculated using the following formula, 3/3 Area = x a² 2 and the perimeter using the formula, P = 6 × a hexagon. • Based on the given formulas write a class called Hexagon that contains o necessary data member(s) where a is the length of one side of the necessary member functions to get input from the user, manipulate the data member(s), and output the result of the perimeter, P and area, Area of the hexagon (2 decimal points). Display the results to the screen as well as a data file named 'hexa.txt'. o constructor to initialize some or all the data member(s) • Write a main function that tests your class by asking the user to input 6 values the length of one side, a, and test the constructor. Following is the example of the output screen and the data file “hexa.txt". Screen from constructor: length Perimeter hexa.txt Area hexa - Notepad 2.00 12.00 10.39 File Edit Format View Help 2.00 12.00 10.39 2.00 12.00 10.39 length Perimeter Area 2.00 12.00 10.39

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

C++

Please ask your lecturer where to submit the coding answer.
In geometry, a hexagon is also a type of polygon with 6 sides. If the hexagon is regular, then the
lengths of all the sides will be the same as well as all the angles will be equal. Clearly, the sides of a
regular hexagon are congruent. To find out the area of a hexagon, it is first divided into small six
isosceles triangles as shown in Figure 1. Then, the area of one of the triangles is calculated and then
multiply by 6 to find the total area of the hexagon.
120°
60
Figure 1: Hexagon
The area of a hexagon can be calculated using the following formula,
3/3
x a?
2
Area =
and the perimeter using the formula, P = 6 x a
hexagon.
where a is the length of one side of the
Based on the given formulas write a class called Hexagon that contains
o necessary data member(s)
o necessary member functions to get input from the user, manipulate the data
member(s), and output the result of the perimeter, P and area, Area of the hexagon
(2 decimal points). Display the results to the screen as well as a data file named
'hexa.txt'.
o constructor to initialize some or all the data member(s)
• Write a main function that tests your class by asking the user to input 6 values the
length of one side, a, and test the constructor. Following is the example of the output
screen and the data file "hexa.txt".
Screen
Erom constructor:
length Perimeter
hеха.txt
Area
hexa - Notepad
2.00
12.00
10.39
File Edit Format View Help
length Perimeter
2.00
12.00
10.39
2.00
12.00
10.39
Area
2.00
12.00
10.39
26 00
02 52
Transcribed Image Text:Please ask your lecturer where to submit the coding answer. In geometry, a hexagon is also a type of polygon with 6 sides. If the hexagon is regular, then the lengths of all the sides will be the same as well as all the angles will be equal. Clearly, the sides of a regular hexagon are congruent. To find out the area of a hexagon, it is first divided into small six isosceles triangles as shown in Figure 1. Then, the area of one of the triangles is calculated and then multiply by 6 to find the total area of the hexagon. 120° 60 Figure 1: Hexagon The area of a hexagon can be calculated using the following formula, 3/3 x a? 2 Area = and the perimeter using the formula, P = 6 x a hexagon. where a is the length of one side of the Based on the given formulas write a class called Hexagon that contains o necessary data member(s) o necessary member functions to get input from the user, manipulate the data member(s), and output the result of the perimeter, P and area, Area of the hexagon (2 decimal points). Display the results to the screen as well as a data file named 'hexa.txt'. o constructor to initialize some or all the data member(s) • Write a main function that tests your class by asking the user to input 6 values the length of one side, a, and test the constructor. Following is the example of the output screen and the data file "hexa.txt". Screen Erom constructor: length Perimeter hеха.txt Area hexa - Notepad 2.00 12.00 10.39 File Edit Format View Help length Perimeter 2.00 12.00 10.39 2.00 12.00 10.39 Area 2.00 12.00 10.39 26 00 02 52
Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Time complexity
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education