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 program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

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