Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

in java pls Assignment2B: Unusual shapes! At this point, we've gotten pretty comfortable with calculating the perimeter and area of squares and rectangles. In this

in java pls
image text in transcribed
Assignment2B: 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 (r* rer) 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. Java C# C++ Math.sqrt (variable) Math.Sqrt(variable) 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

Microsoft Visual Basic 2008 Comprehensive Concepts And Techniques

Authors: Gary B. Shelly, Corinne Hoisington

1st Edition

1423927168, 978-1423927167

More Books

Students also viewed these Databases questions

Question

6. Explain how to train managers to coach employees.

Answered: 1 week ago