The area of an arbitrary triangle can be computed using the formulaarea = √(s(s–a)(s–b)(s–c))where the square root is applied to the entire product (Links to an external site.) and where a, b, and c are the lengths of the sides, and s is thesemiperimeter  of the triangle given (Links to an external site.) by the formula:s = (a + b + c)/2 Write a void function named (Links to an external site.) triangle  that computes the area and perimeter(as well as the semiperimeter which will be used to compute the area)of a triangle based (Links to an external site.) on the length ofthe sides. The function should use five parameters (Links to an external site.)—three value (Links to an external site.)parameters (Links to an external site.) that provide the lengths of the edges and two referenceparameters (Links to an external site.) that store (Links to an external site.) the computed area and perimeter respectively. Make yourfunction robust. Note that not all combinations of a, b, and cproduce a triangle. Your function should produce correct resultsfor legal data and reasonable results for illegal combinations. Includein your submission a driver that repeatedly reads in 3 positive numbers thatare the sides of a triangle, and each time print out the sides and the areaand perimeter calculated by the triangle function. Your program (Links to an external site.) shouldterminate when the first side typed (Links to an external site.) in a group of three is negative or zero.

Question

The area of an arbitrary triangle can be computed using the formula

area = √(s(s–a)(s–b)(s–c))

where the square root is applied to the entire product (Links to an external site.) and where a, b, and c are the lengths of the sides, and s is the
semiperimeter  of the triangle given (Links to an external site.) by the formula:

s = (a + b + c)/2


Write a void function named (Links to an external site.) triangle  that computes the area and perimeter
(as well as the semiperimeter which will be used to compute the area)
of a triangle based (Links to an external site.) on the length of
the sides. The function should use five parameters (Links to an external site.)—three value (Links to an external site.)
parameters (Links to an external site.) that provide the lengths of the edges and two reference
parameters (Links to an external site.) that store (Links to an external site.) the computed area and perimeter respectively. Make your
function robust. Note that not all combinations of a, b, and c
produce a triangle. Your function should produce correct results
for legal data and reasonable results for illegal combinations. Include
in your submission a driver that repeatedly reads in 3 positive numbers that
are the sides of a triangle, and each time print out the sides and the area
and perimeter calculated by the triangle function. Your program (Links to an external site.) should
terminate when the first side typed (Links to an external site.) in a group of three is negative or zero.

 

 

 

Expert Answer

Want to see the step-by-step answer?

Check out a sample Q&A here.

Want to see this answer and more?

Experts are waiting 24/7 to provide step-by-step solutions in as fast as 30 minutes!*

*Response times may vary by subject and question complexity. Median response time is 34 minutes for paid subscribers and may be longer for promotional offers.
Tagged in
Engineering
Computer Science

Related Computer Science Q&A

Find answers to questions asked by students like you.

Q: In MS Access, which character will be used for an optional digit such as 0, 1, 2, ..., 9? A) 0 B) 9 ...

A: Microsoft (MS) AccessMicrosoft access is a database management system from Microsoft that combines r...

Q: this is for python

A: Program descriptionTwo lists are created one is a 3 x 3 list and the other 4 x 4 to demonstrate the ...

Q: Consider the window size is 10, bandwidth is 1500 bps, transmission delay is 2 ms atpropagation dela...

A: Given information:

Q: This program is written in pseudocode."Design a program that generates a 7-ddigit lottery number. Th...

A: As you have not specified the programming language, we have solved this question using C++ programmi...

Q: Create a program that prompts the user for an amount less than 100 and then displays the minimum num...

A: As you have not specified the programming language, we solved this question using python programming...

Q: (check all that are necessary) Which Oracle server parameters do you need to know in order toset up ...

A: Oracle server parameters required for the client to connect to the server are:Host name or the IP ad...

Q: Python 3.7.4 Given that d refers to a dictionary, change the value mapped to by the key 'Monty' to '...

A: d refers to a dictionary and if we need to change the value mapped to by the key ‘Monty’ to ‘Python’...

Q: An uppercase character is a character whose ASCII value is between 65(A) and 90(Z). Write a C++ prog...

A: Following is the c++ program:For loop is used to from 0 to length of string to read every character ...

Q: Suppose you have two tables: EMPLOYEE and EMPLOYEE_1. The EMPLOYEE table contains the records for th...

A: To display the output of the given tables by using UNION operator.Two tables are given:First Table n...

Q: Write a program that generates a two-column table showing Fahrenheit temperatures from -40F to 120F ...

A: Java program://Create a class name "temperature"public class temperature{     //Definition for main ...

Q: What are the different computer languages? Give a brief description of each.

A: DefinitionLanguage is the basic way of communication between the computer systems and to communicate...

Q: Why did  Cisco systems transition from a standalone access control system to an IP networked systems...

A: Standalone control systems:Basic access control systems.Used at a single location.Not networked with...

Q: Use the Design Recipe to write a function weighted_total(number_list,weights) that consumes a list o...

A: The given list of numbers is [1, 2, 3].The given weights are [0.1, 0.5, 0.4].weighted_total(number_l...

Q: what is a loop

A: DefinitionIn programming languages, a loop is an arrangement of commands that is frequently repeated...

Q: program7_1.pyWrite a Python program that creates a list of your friends. Start with an empty list a...

A: Program:frd_list = []frdName = input('Enter the first name of a friend or ENTER to quit ')frdName = ...

Q: EXPLAIN ALL STEPS: Determine the output of the following Pep/9 machine language program if the input...

A: Address   Instruction(in hex)0000         D1FC15Convert the instructions into binary form-D=11011=00...

Q: In C++ why is a binary search function almost always more efficient than a linear search function?

A: In C++, binary search function is more efficient than linear search function because:Array must be s...

Q: How would you modify the dynamic programming algorithm for the coin collecting problem if some cells...

A: Coin collecting problemIn a n-m board, several coins are placed in such a way no more than one coin ...

Q: Fall 2019 1. (What will be printed by the following statements when wt is equal to 160, 220 or 240? ...

A: Few points about If-else condition:If the IF-condition is true then program control would skip ELSE-...

Q: in python   Write a Python program that uses a for loop with the range function to inspect all integ...

A: Multiples() function defines to display these two totals.

Q: Business example: Precision Tools sells a line of high-quality woodworking tools. When customers pla...

A: Context diagram:The Context Diagram shows the system being viewed as a single high-level entity and ...

Q: Given a nested list named table, use nested loops to print each element in the nested list.  Each el...

A: Python program to all the elements in a nested listProgram IntroCreate a python program to print all...

Q: Beacon frames in the frequency hopping spread spectrum variant of 802.11 contain the dwell time. Do ...

A: NO,  as we know the Bluetooth frame has dwell time of 625p sec for basic data rate in the frame its ...

Q: What role does database technology play in managing data as a business resource within an organizati...

A: Data resource management is applying software tools and information systems technologies such as dat...

Q: Research and describe one interesting application of data or text mining.

A: Data miningData mining is the process of discovering patterns of data in large data sets using metho...

Q: Databse SQL Queries. Need to write the SQL code for pulling the total cost of our inventory. We have...

A: A SQL query is to be written that will give the total cost of inventory. Two tables are given named ...

Q: Are the following two clauses the same: constraint X primary key (Y, Z) and constraint X primarykey ...

A: Primary key:Primary key is a key which is used to uniquely identify a row in a table.A Primary key c...

Q: 2. You are again working for the census bureau and they need some statistics regarding the distribut...

A: Create a PYTHON3 program, and import all required modules for the given problem, import the "statist...

Q: Find the truth table that describes the following circuit.

A: The given circuit diagram shows operations for each gate. The final Boolean expression found through...

Q: Write a program (IN C++) that will present the user with a main menu of options which the user can c...

A: Click to see the answer

Q: Many documents use a specific format for a person's name. Write a program whose input is: firstName ...

A: This program can be done in a very easy way. Programming instruction: First, take the input from the...

Q: Python 3.7.4: Write a loop that reads positive integers from standard input and that terminates when...

A: Following is the program code that takes input from the user all positive integer and terminates if ...

Q: Write a program in Java Eclipse that does the following:a) create a 2D Ragged array with columns and...

A: Create a Main class and all required methods to print Ragged array elements. And create all methods ...

Q: Computer Science Question

A: Note: As per the guidelines Q1 with three sub-parts can be answered. Re-post the question for the so...

Q: 1. Write a program in Python named filemaker.py that will be used to store the first name and age of...

A: This python program asks user to enter First name and Age of a number of friends. This program name ...

Q: Create a new file (in Dev C++) and save it as lab10_XYZ.cpp (replace XYZ with your initials). In La...

A: C++ programThe code for calculator programs is#include <iostream>using namespace std;void disp...

Q: Assign secretID with firstName, a space, and lastName. Ex: If firstName is Barry and lastName is All...

A: To correct the given program code to assign the secretID as firstName,  space, and lastName, as show...

Q: Write a C++ program: to iteratively compute Fibonacci numbers (named after an Italian mathematician)...

A: A C++ program to generate fibonacci series using recursion is given below,Program://Declare header f...

Q: Suppose you want to build a program using WebGL that draws two kinds of objects - shiny billiard bal...

A: Drawing multiple objects in WebGLIn order to draw two kinds of objects in WebGL, first call function...

Q: Write a query to display the book number, title, and cost for all books in the “Database” subject so...

A: The name of the table is the subject.Attributes of the table are book_number, book_title, book_costC...

Q: Hello, I am a novice working with Java. I am creating an amortization schedule (pictured below) and ...

A: Declare and initialize two more double type variable totalamorized and lastamorized.Calculate these ...

Q: Select the FSMO role that is required to be online to facilitate the addition or removal of a domain...

A: Domain Controller:Domain controller is a server computer on Microsoft servers.The purpose of domain ...

Q: in python This program requires two functions. In the main function: create an empty list. use a lo...

A: Programming instructions: First, make a list with no values.Then, utilize for-loop to add values in ...

Q: I want to see how one can add 80 elements into an array without manually entering in each element.  ...

A: Given,The name of the first array is numberArray1 and the size of the array is 80.The name of the se...

Q: What are whole disk encryption (WDE) solutions and under what circumstances are they required?

A: DefinitionWhole Disk Encryption (WDE) solutions, basically plays the foremost role in the field of c...

Q: The class RoachPopulation simulates the growth of a roach population.The constructor takes the size ...

A: Program code #1:

Q: In Python Use the Design Recipe to write a function has_duplicates, which consumes a list and return...

A: This program returns true when a list has duplicate value, if the list has not any duplicate value t...

Q: Why is Big O preferred than Big Theta or Big Omega when analyzing algorithms?

A: Click to see the answer

Q: WHAT ARE THE STAKEHOLDERS OF BITCOIN VALUE CHAIN?

A: The stakeholders in bitcoin value chain are:Developers Developers play an important role as they use...

Q: Siobhan’s laptop has 8GB of RAM. Her operating system takes up 2GB, andher application programs use ...

A: It also depends that whether the graphic card is installed or not otherwise an 8 Gb of RAM itself is...