The area of a triangle (whose sides have lengths a, b and c) can be calculated...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
The area of a triangle (whose sides have lengths a, b and c) can be calculated using Heron's formula as shown in Eqs. (2) and (3). a. (5 Marks) Write a C++ function that calculates the area of a triangle using Heron's formula. b. (10 Marks) Use the function in a program that prompts the user for the lengths of the sides of a triangle and displays the area of the triangle. a. After displaying the value, the program should indefinitely go back to prompt for the lengths of sides of the next triangle then recalculate and display the area. The program should quit when the user enters a negative number. The prompt of the program should inform the user as to how to quit it (by entering a negative number for a length of the triangle's side). c. (15 Bonus Marks) Modify the program in b. so that it takes the x, y and z coordinates as user input and then computes the lengths of the triangle's sides before computing the area. HINT: include b. c. Area, A = s(s-a)(s -b)(s-c) a+b+c 2 S= (2) (3) The area of a triangle (whose sides have lengths a, b and c) can be calculated using Heron's formula as shown in Eqs. (2) and (3). a. (5 Marks) Write a C++ function that calculates the area of a triangle using Heron's formula. b. (10 Marks) Use the function in a program that prompts the user for the lengths of the sides of a triangle and displays the area of the triangle. a. After displaying the value, the program should indefinitely go back to prompt for the lengths of sides of the next triangle then recalculate and display the area. The program should quit when the user enters a negative number. The prompt of the program should inform the user as to how to quit it (by entering a negative number for a length of the triangle's side). c. (15 Bonus Marks) Modify the program in b. so that it takes the x, y and z coordinates as user input and then computes the lengths of the triangle's sides before computing the area. HINT: include b. c. Area, A = s(s-a)(s -b)(s-c) a+b+c 2 S= (2) (3)
Expert Answer:
Related Book For
Posted Date:
Students also viewed these programming questions
-
Briefly describe ASCII and Unicode and draw attention to any relationship between them. [3 marks] (b) Briefly explain what a Reader is in the context of reading characters from data. [3 marks] A...
-
Portray in words what transforms you would have to make to your execution to some degree (a) to accomplish this and remark on the benefits and detriments of this thought.You are approached to compose...
-
. Current price of stock is $20 and expected price after one year is 22.5. If investor required return is 18%. What percentage of dividend should company pay?
-
In response to Chinese consumers' distaste for Best Buy's prices and large store size, Best Buy elected to close all of its stores and focus on its chain of local Jiangsu Five Star stores. Does this...
-
What distinguishes a real-time operating system from a general-purpose operating system? Discuss the use cases for RTOS and the challenges in meeting real-time requirements.
-
1. Find the cumulative area that corresponds to a z-score of 1.15. 2. Find the cumulative area that corresponds to a z-score of 0.24.
-
You are provided with the following information for Web Inc. for the month ended June 30, 2010.Web uses the periodic method for inventory. Instructions(a) Calculate (i) ending inventory , (ii) cost...
-
A rock is thrown at a 95.0 angle above the horizontal across level ground. It is thrown from a height of 3.00 m above the ground with a speed of 23.0 m/s and experiences no appreciable air...
-
Holmes Corporation is a leading designer and manufacturer of material handling and processing equipment for heavy industry in the United States and abroad. Its sales have more than doubled, and its...
-
draw a scenario that can be represented by multiprocessing operating system, multitasking operating system, distributed operating system and spooling..
-
A person you trust asks you to loan them \($2\),000 at the end of year 1, \($1\),000 at the end of year 2, nothing in year 3, and then they will pay you \($1\),000 in year 4, \($2\),000 in year 5,...
-
How much money can be withdrawn at the end of 15 years if a. $ 2 $ 2 ,000 is deposited at the end of each year and earns 5 percent/year compounded annually? b. $ 3 $ 3 ,000 is deposited at the end of...
-
An easy payment plan offered by a local electronics store for your new audio system calls for payments of $2,000, $2,500, $3,000, and $3,500 at the ends of years 1 through 4, respectively. Your money...
-
A series of 25 end-of-year deposits is made that begins with $1,000 at the end of year 1 and increases at the rate of $200 per year with a 12 percent interest rate compounded annually. a. What amount...
-
Janie deposits \($10\),000 in the bank today. Starting 3 years from now, she makes equal withdrawals of \($1\),000 for 5 years and then withdraws the remaining amount 10 years from now. How much will...
-
Henry told us in his guide to the Institutional Framework of Taxation in Australia that the Australian Taxation System is one of the most complex in the world and is made up of approximately 125...
-
Find the equations of the ellipses satisfying the given conditions. The center of each is at the origin. Passes through (2, 2) and (1, 4)
-
A vector is given by x = [4.5 5 -16.12 21.8 10.1 10 -16.11 5 14 -3 3 2]. Using conditional statements and loops, write a program that rearranges the elements of x in order from the smallest to the...
-
The geometry of a ship hull (Wigley hull) can be modeled by the equation where x, y, and z are the length, width, and height, respectively. Use MATLAB to make a 3-D figure of the hull as shown. Use B...
-
The arc length of a segment of a parabola ABC of an ellipse with semi-minor axes a and b is given approximately by: LABC = 1/2b2 + 16a2 + b2/8a In(4a + b2 + 16a2)/b. (a) Determine LABC if a = 11 in....
-
Discuss the effect of initial trust region radius (ITRR) on the performance of TR algorithm.
-
Is the result of any Trust Region method depends on the initial guess value \(X_{0} \in \mathbb{R}^{n}\) ? Justify your answer.
-
Give some examples of unconstrained optimization in the field of chemical engineering.
Study smarter with the SolutionInn App