In C++ write a function Vol that takes in three parameters and returns the volume of...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
In C++ write a function Vol that takes in three parameters and returns the volume of a rectangular pyramid. Then overload Vol to take to take in two parameters (double) and return the volume of a square pyramid. Test the overloaded function Vol in your main function by calling each of them with its arguments. Test case below Welcome to the pyramid calculator! Please enter 's' for square pyramid or 'r' for rectangular: s You chose square! Please enter a length and height, separated by a space: 4.5 6.8 The volume of the pyramid whose attributes you entered is: 45.9 Would you like to continue using this program? (y/n) y Welcome to the pyramid calculator! Please enter 's' for square pyramid or 'r' for rectangular: r You chose rectangular! Please enter a length, width, and height, separated by spaces: 5.7 11.34 9.3 The volume of the pyramid whose attributes you entered is: 200.378 Would you like to continue using this program? (y/n) n Thank you for using the pyramid volume calculator. Bye! In C++ write a function Vol that takes in three parameters and returns the volume of a rectangular pyramid. Then overload Vol to take to take in two parameters (double) and return the volume of a square pyramid. Test the overloaded function Vol in your main function by calling each of them with its arguments. Test case below Welcome to the pyramid calculator! Please enter 's' for square pyramid or 'r' for rectangular: s You chose square! Please enter a length and height, separated by a space: 4.5 6.8 The volume of the pyramid whose attributes you entered is: 45.9 Would you like to continue using this program? (y/n) y Welcome to the pyramid calculator! Please enter 's' for square pyramid or 'r' for rectangular: r You chose rectangular! Please enter a length, width, and height, separated by spaces: 5.7 11.34 9.3 The volume of the pyramid whose attributes you entered is: 200.378 Would you like to continue using this program? (y/n) n Thank you for using the pyramid volume calculator. Bye!
Expert Answer:
Answer rating: 100% (QA)
Here is the C code that calculates the volume of a rectangular pyramid and a square pyramid C include using namespace std Function to calculate the volume of a rectangular pyramid double volRectangula... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
Design a Java class that represents a cache with a fixed size. It should support operations like add, retrieve, and remove, and it should evict the least recently used item when it reaches capacity.
-
Let A, B be sets. Define: (a) the Cartesian product (A B) (b) the set of relations R between A and B (c) the identity relation A on the set A [3 marks] Suppose S, T are relations between A and B, and...
-
What is the effect of a viscosity (competence) difference between strain markers and the matrix?
-
An instructor measured quiz scores and the number of hours studying among a sample of 20 college students. If SSXY = 43, SSX = 99, MY = 6, and MX = 5, then what is the regression equation for this...
-
Solve the given inequalities algebraically and graph each solution. 3x + 1 < 5
-
On March 13, 2009, Juan Mendez Sr. was admitted to a nursing facility. On that day, a doctor employed by the facility determined the father lacked the capacity to give informed consent or make...
-
(Pension Expense, Journal Entries, Statement Presentation) Ferrari Company received the following selected information from its pension plan trustee concerning the operation of the company's defined...
-
If the trend towards authoritarianism continues and more democracies move towards the totalitarian side of the spectrum, how could that affect the international political system?
-
After reviewing the diagram in Figure 65 on page 220 of the textbook describe one 1 example of your own where a recipient could process the source message through the central route or the peripheral...
-
5. Suppose an economy can produce two goods, A and B. It is now operating at point E on production possibilities curve RT. An improvement in the technology available to produce good A shifts the...
-
On June 30, 2016, the Big Three Company purchased equipment from Randall Corp. Big Three agreed to pay Randall $12,000 on the purchase date and the balance in five annual installments of $14,739 on...
-
There are common change processes that face most organizations. Some of the changes affect the processes of doing business, and some of the changes affect the people within the organization. One of...
-
V company uses perpetual inventory method. On January 1, 2018, V company 300 units of inventory, each unit costing 1 dollar. On January 10, 2018, the company purchased 400 units of inventory, each...
-
For the year ended December 31, 2017, Mont Co. recorded pre-tax book income of $600. To compute taxable income for federal income tax purposes, the following items should be noted: Income from...
-
What are the two acids in CH,OH HCoe + CH,0 e + the reaction? () , (B) CH,OH HCOH (C) (D) CH;OH HCOE
-
Audrey purchases a riding lawnmower using a 2-year, no-interest deferred payment plan at Lawn Depot for x dollars. There was a down payment of d dollars and a monthly payment of m dollars. Express...
-
View two of the safety acronym links and write an evaluation as to whether or not the link was useful. A graph of F subscript A 0 over negative r subscript A is shown. Initially, the value of F...
-
There is a 2-m 3 reactor in storage that is to be used to carry out the liquid-phase second-order reaction A + B C A and B are to be fed in equimolar amounts at a volumetric rate of 1 m3/min. The...
-
The following E(t) curve was obtained from a tracer test on a reactor. E(t)=0.25t04 t in minutes, and E(t) in min 1 . The conversion predicted by the tanks-in-series model for the isothermal...
-
For coordinates \(\left(x^{1}, x^{2} ight)\) and metric \(g=\operatorname{diag}\left(g_{11}, g_{22} ight)\), the Gaussian curvature is For a sphere with coordinates defined in the following figure,...
-
Consider the holonomic basis defined in Box 26.1 . Using that the tangent vector for a curve can be written \(t=t^{\mu} e_{\mu}=\left(d x^{\mu} / d \lambda ight) e_{\mu}\), show that Thus, \(g_{\mu...
-
The Lie bracket of vector fields \(A\) and \(B\) is defined as their commutator, \([A, B]=\) \(A B-B A\). The Lie bracket of two basis vectors vanishes for a coordinate basis but not for a...
Study smarter with the SolutionInn App