Unusual shapes! At this point, we've gotten pretty comfortable with calculating the perimeter and area of...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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 *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 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 *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
Expert Answer:
Related Book For
Posted Date:
Students also viewed these programming questions
-
"internet radios" for streaming audio, and personal video recorders and players. Describe design and evaluation processes that could be used by a start-up company to improve the usability of such...
-
Calculate the Total Cost of Ownership of the following 2 models and determine which model is a better buy. Model X Model Y $50,000 $60,000 Purchase price = Expected useful life = Maintenance cost per...
-
The Ka of a certain indicator is 2.0 3 1026. The color of HIn is green and that of In2 is red. A few drops of the indicator are added to a HCl solution, which is then titrated against a NaOH...
-
Starrs Bakery started 12 months ago as a supplier of gluten-free desserts to restaurants all over the province. During its first year of operations it earned $62,000 in revenues and incurred $51,000...
-
Identify the unknown \(\mathrm{X}\) in the following decays: a. \({ }_{86}^{222} \mathrm{Rn} ightarrow{ }_{84}^{218} \mathrm{Po}+\mathrm{X}\) b. \({ }_{88}^{228} \mathrm{Ra} ightarrow{ }_{89}^{228}...
-
The records of Paramount Color Engraving reveal the following: Compute cash flows from operating activities by the indirect method for year ended December 31, 2016. $40,000 Depreciation expense Net...
-
How does the process of normalization in database design mitigate redundancy and ensure data integrity through the systematic organization of relational tables and elimination of data anomalies ?
-
List specific problems that people from different cultures could face during their visit to a physician for the first time?
-
2) Clifton's Parks and Recreation Department is introducing a new summer day camp for children in elementary school, providing programming from 8:00 a.m. to 5:00 p.m. Monday through Friday. The...
-
Competition is most influential external factors on any company in the industry. In the above table, your group has been assigned to one of the automakers as your group's client. You and your group...
-
What is the basic accounting entry for an initial revaluation decrease of a non depreciable asset ?Explain
-
It's hard to miss the ads on TV for reverse mortgages. Over the last few years, almost every "senior" actor has made ads promoting these loans. Currently, Tom Selleck seems to be the most prominent....
-
Critically discuss the factors that must be considered by contractors when deciding to develop a proposal. (16) 2.2 Describe three (3) three key factors that the contractor should highlight in the...
-
For each of the following independent cases, use the equation method to compute the Economic Order Quantity Annual Requirement (in units) Cost Per Order Annual Holding Cost Per Unit Case A 13,230 250...
-
In muscle tissue, the ratio of phosphorylase a to phosphorylase b determines the rate of conversion of glycogen to glucose 1phosphate. Classify how each event affects the rate of glycogen breakdown...
-
Consider the common problems with project cost estimation and recall a project with which you have been involved. Which of these common problems did you encounter most often? Why?
-
This chapter suggests that estimating project costs is a challenging process that can resemble an art form as much as science. Describe the different methods used to estimate costs on a project. How...
-
Explain the concept of activity-based costing. What are the steps involved in this process?
Study smarter with the SolutionInn App