Reference no: EM131016481
Project - Winter 2016
The purpose of this project is to write a set of functions that calculate the volume of a slant cylinder (actually a prism) with an irregular pentagonal cross section shown in Figure 1.
You will be given the coordinates of the corners of the pentagon (five pairs of x,y values), and the value h, the vertical height of the prism. You must read the file* and fill the two vectors x and y that will contain the coordinates. x and y are two one-dimensional arrays. Now, we will need to break this problem apart, writing functions to solve each part. Note that the development of these parts will not occur in order necessarily (in fact it is recommended that you write the function in part 4 first (tri_side) and then write the other ones in reverse order.
1. The volume of the prism is the area of the pentagon multiplied by the vertical height. Write a function named polyvol to solve this.
2. The area of the pentagon is the sum of the areas of three triangles as shown in Figure 2. So we need to write a function named pent_area that takes in the area of the three triangles and adds them together.
3. Given the coordinates of the corners of the triangle, we need to write a function named tri_area to calculate the area of the triangle (see Figure 3). To compute the area of the triangle, we need the values a, b, and c. So if we had the lengths of the lines, the area of the triangle is given by Heron's formula:
A = ( s(s-a) (s-b) (s-c) ) where s is half the sum of a, b, and c.
4. Then, we need a function named tri_side that computes the length of a line when given its end points. (You may need to review a bit of high school geometry to write that simple function)
5. Finally, put it all together by writing the main program that will read a data file, then call the polyvol function (and in turn, from it, the other functions) and display the volume of the prism in cubic meters. Test/run your program for each of the two data files (test cases).
Attachment:- p2.rar
Determine a formula that counts the numbers of nodes
: Determine a formula that counts the numbers of nodes in the recursion tree. What is Big- O for execution time? Determine a formula that expresses the height of the tree. What is the Big-O for memory?
|
How many times will the bell be struck in two days
: If clock strikes once at one o clock, twice at two o clock, and twelve times at twelve o clock, and again one at one o clock and so on. How Many times will the bell be struck in 2 days.
|
Explain how non-volatile ram can help speed up disk writes
: Since indexes speed up searches, why wouldn't the DBMS automatically create an index for every column of a table?
|
Social media and marketing technology in an essay
: In this assignment, you will explore social media and marketing technology in an essay. In your essay, choose a brand (or product) that relies heavily on social media or technology to market their product. Examples would be Netflix, Uber, or Coca-..
|
Calculate the volume of a slant cylinder
: Write a set of functions that calculate the volume of a slant cylinder (actually a prism) with an irregular pentagonal cross section - Write a function named polyvol to solve this.
|
How enculturation may play a role in the case study
: Discuss the methodology associated with cross-cultural psychology research. Discuss how the case study helps you better understand how ethnicity, race, and worldviews are separate yet related concepts. Discuss how enculturation may play a role in the..
|
Improving nonverbal communication in the text
: Describe a time when nonverbal communication caused you to misinterpret the message in a work situation (explain the type of nonverbal cue using the information in the text). Then, using the guidelines for improving nonverbal communication in the ..
|
How do we know that the eigenvalues of a are all real
: How do we know that the eigenvalues of A are all real and distinct before we calculate them? Find the characteristic polynomial of A. Find the eigenvalues of A.
|
How is laura behavior indicative of role confusion
: How is Laura's behavior indicative of role confusion as discussed by Erik Erikson's model of psychosocial development? How are her peer relationships affecting her decisions
|