The area of an arbitrary triangle can be using the formula
where a, b, and c are the lengths of the sides, and s is the semiperimeter:
Write a void function that uses five parameters: three value parameters that provide the lengths of the edges and two reference parameters that compute the area and perimeter (not the semiperimeter). 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.
Want to see the full answer?
Check out a sample textbook solutionChapter 4 Solutions
ABSOLUTE C++ -TEXT
Additional Engineering Textbook Solutions
Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
Electric Circuits. (11th Edition)
Thinking Like an Engineer: An Active Learning Approach (4th Edition)
Java How to Program, Early Objects (11th Edition) (Deitel: How to Program)
Concepts Of Programming Languages
Starting Out with Python (4th Edition)
- Python XYZ store plans to give a festival discount to its customers. The store management has decided to give discount on the following criteria: Shopping Amount Discount Offered >=500 and <1000 5% >=1000 and <2000 8% >=2000 10% An additional discount of 5% is given to customers who are the members of the store. Create a program using user defined function that accepts the shopping amount as a parameter and calculates discount and net amount payable on the basis of the following conditions:Net Payable Amount = Total Shopping Amount – Discount.arrow_forwardprintTodaysDate is a function that accepts no parameters and returns no value. Write a statement that calls printTodaysDate.arrow_forwardIn physics, an object that is in motion is said to have kinetic energy. The following formula can be used to determine a moving object’s kinetic energy:KE=12mv2The variables in the formula are as follows: KE is the kinetic energy, m is the object’s mass in kilograms, and v is the object’s velocity in meters per second. Write a function named kinetic_energy that accepts an object’s mass (in kilograms) and velocity (in meters per second) as arguments. The function should return the amount of kinetic energy that the object has. Write a program that asks the user to enter values for mass andvelocity, then calls the kinetic_energy function to get the object’s kinetic energy.arrow_forward
- LAB Write a program that has three functions. The first ask the user to enter a temperature in degrees celcius. The second takes a single parameter that is a temperature in degrees Celsius and returns the corresponding temperature in Fahrenheit. The thirsd function takes one parameter, a temperture in celsius and print the temperature in Celsius along with the corresponding temperature in Fahrenhiet. This function will use the second function. Then write a complete program that asks the user for a temperatre in Celsius and prints the corresponding temperature in Farenheit.arrow_forwardPython Returning Funtion function name: bound_0_to_100 parameters:a number grade returns: the grade with a minimum of 0 and a maximum of 100 behavior: In addition to exceeding 100, sometimes a grade will be so spectacularly bad that it falls below 0. In that case we want to normalize it to 0 so all grades fall into the range [0, 100]. ex: bound_0_to_100(75) returns 75, bound_0_to_100(103) returns 100, and bound_0_to_100(-5) returns 0arrow_forwardtrue false void ffx() is a function with no return value void ffx() is a function with no argument int ffx(char x) is a function with int return value int ffx(char *x) is a function with parameter passed by reference char ffx( int x) is a function with int return value int ffc(char &x) is a function with parameter passed by referencearrow_forward
- A function can return another function. True Falsearrow_forwardCreate a function which returns the type of triangle, given the side lengths. Return the following values if they match the criteria. • No sides equal: "scalene" • Two sides equal: "isosceles" • All sides equal: "equilateral" • Less or more than 3 sides given: "not a triangle" Examples get_triangle_type([2, 6, 5]) "scalene" get_triangle_type([4, 4, 7]) "isosceles" get_triangle_type([8, 8, 8]) "equilateral" get_triangle_type([3, 5, 5, 2]) → "not a triangle"arrow_forwardThe 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 and where a, b, and c are the lengths of the sides, and s is thesemiperimeter of the triangle given by the formula:s = (a + b + c)/2 Write a void function named triangle that computes the area and perimeter (as well as the semiperimeter (which will be used to compute the area)of a triangle based on the length of the sides. The function should use five parameters and may call other functions.Make your function robust. Note that not all combinations of a, b, and c produce a triangle. Your function should produce correct resultsfor legal data and reasonable results for illegal combinations. Include in 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 area and perimeter calculated by the triangle function. Your program shouldterminate when the…arrow_forward
- Code in C++ language 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 and where a, b, and c are the lengths of the sides, and s is thesemiperimeter of the triangle given by the formula: s = (a + b + c)/2 Write a void function named triangle that computes the area and perimeter (as well as the semiperimeter (which will be used to compute the area)of a triangle based on the length of the sides. The function should use five parametersand may call other functions.Make your function robust. Note that not all combinations of a, b, and c produce a triangle. Your function should produce correct resultsfor legal data and reasonable results for illegal combinations. Include in 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 area and perimeter calculated by the triangle function. Your program…arrow_forwardIn python, write a function that receives three parameters: name, weight, and height. The default value for name is James. The function calculates the BMI and returns it. BMI is: weight/(height^2). Weight should be in kg and height should be in meters. For instance, if the weight is 60 kg and the height is 1.7 m, then the BMI should be 20.76. The function should print the name and BMI. The function should return 'BMI is greater than 22' if the MBI is greater than or equal to 22. Otherwise, the function should return 'BMI is less than 22'. Call the function and print its output.arrow_forwardCreate an inner function to calculate the addition in the following way, Create an outer function that will accept two parameters, x and y Create an inner function inside an outer function that will calculate the addition of x and y Then, an outer function will add 10 into addition and return it Use values 15 and 20 or user input values. Output: The result is: 45arrow_forward
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningProgramming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage Learning
- Microsoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,