Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can someone code this in java using Math sqrt Unusual shapes! At this point, we've gotten pretty comfortable with calculating the perimeter and area of

Can someone code this in java using Math sqrt
image text in transcribed
Unusual shapes! At this point, we've gotten pretty comfortable with calculating the perimeter and area of squares and rectangles. In this assignment, we'll make a program that calculates these values for regular pentagons and hexagons! Pentagon Hexagon Research the formulas to calculate the area of regular pentagons and hexagons, and implement them in your code Hint: You can replicate exponents using multiplication. For example, r' is the same as (rr). You will likely also need to use square root . We will learn more about functions later in the course, but for now you can use the following commands. C# Java Math.sqrt ( variable) Math.Sqrt ( variable) C++ Sqrt(variable) Example Usage: double result = Math.sqrt( 4 ); //result will equal 2 Your task is to: A) Prompt the user to enter the necessary information to calculate the area and perimeter of a pentagon and hexagon B) Read in those values C) Perform calculations to the perimeter and area of each shape D) Display the result to the user The algorithm output is as shown below, with user input in bold. Save your source code in a file called Assignment2B (with a file extension of.cpp .cs or java) Sample Output [Pentagon Calculator] Enter the length of one side: 7 Pentagon Perimeter = 35 Pentagon Area = 84.3 [Hexagon Calculator] Enter the length of one side: 9 Hexagon Perimeter = 54 Hexagon Area = 210.44

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

Step: 3

blur-text-image

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

More Books

Students also viewed these Databases questions

Question

How do Data Types perform data validation?

Answered: 1 week ago

Question

How does Referential Integrity work?

Answered: 1 week ago