Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

please in C#
image text in transcribed
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, 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) 04 Sqrt ( variable) Math.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 Quinu: [Pentagon Calculator Enter the length of one side 7 te the area of regular pentagons and hexagons, and implement them in your code. Hint: You can replicate exponents using multiplication. For example, is the same as (r*r). 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 Math.sqrt ( variable ) C# 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

Databases Illuminated

Authors: Catherine M. Ricardo

1st Edition

0763733148, 978-0763733148

More Books

Students also viewed these Databases questions

Question

How many Tables Will Base HCMSs typically have? Why?

Answered: 1 week ago

Question

What is the process of normalization?

Answered: 1 week ago