Calculate the volume of a slant cylinder

Assignment Help C/C++ Programming
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

Reference no: EM131016481

Questions Cloud

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

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Create a program that asks the user to enter in two numbers

Create a program that asks the user to enter in two numbers. Pass the two numbers as arguments to a function. If the sum of the numbers is greater than 10, the function returns true. Otherwise the function returns false

  Write the output of the program

Design a C++ program that will interactively prompt for and read the name of the input file interactively prompt for and read the name of a file to write the output of the program to write the following to the specified output file your name, sect..

  Give a recursive definition of s.

Let S be the set of positive integers that can be written as a sum of one or more 4's and/or 7's. For example, 7 ? S and 18 ? S (because 18 = 4 + 7 + 7)

  You have just upgraded your system

You have just upgraded your system to a "fast and wide" SCSI interface. This system has a floppy disk, a CD-ROM and five 8-gigabyte fixed disks. What is the device number of the host adapter? Why?

  Write a program using for loops t

Write a program using for loops to produce the following output. Please read carefully the entire specification!

  Make a function in dr racket

Make a function in Dr Racket that consumes a string and figures out if it starts with a specific letter of the alphabet - Can you help me how should I go about this? Please any ideas?

  Extend the definition of the class clocktype by overloading

a. Extend the definition of the class clockType by overloading the post-increment operator function as a member of the class clockType

  Write cpp program that declare single dimensional arrays

Write a c++ program that declare three single dimensional arrays nammrs: price, quantity, amount. Number for the price.

  Write a program that asks for the starting time

Write a program that asks for the starting time and the number of minutes of the call, and display the charges. The program should ask for the time to be entered as a floating-point number in the form HH.MM. For example, 07:00 hours will be entered a..

  Write a function named largest which will receive the array

Write a function named largest which will receive the array as input and return the variable LargestNumber.

  Write procedure sort that swaps its three inputs

Write a procedure sort3(int& a, int& b, int& c) that swaps its three inputs to arrange them in sorted order. Without actually compiling and running a program, determine the results of the given function calls.

  Design an algorithm to find the selling price

To make a profit, the prices of the items sold in a furniture store are marked up by 60%. Design an algorithm to find the selling price of an item sold at the furniture store. What information do you need to find the selling price?

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd