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++
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)
- Write the following function: Name: CylinderVolume Parameters: r (int), h (double) Calculate and return the volume of a cylinder The formula for volume of a cylinder is: Volume = pi*r2 * h In main() input the radius (int) and the height (double) of a cylinder. Then use the function CylinderVolum() to calculate the volume and then display the volume. Limit the output to 2 decimal places.arrow_forwardPython 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_forwardFunction #2: largest Parameters: num1 - a floating point number being compared against num2 and num3 num2 - a floating point number being compared against num1 and num3 num3 - a floating point number being compared against num1 and num2 Description: Write a function that takes in three numbers as parameters and prints out the largest of the three. If two or all of the numbers are equal, or even all three, then just print the value once. Test Cases: >>>largest(433.1, 2340.32, 12323.7) 12323.7 >>>largest(12.0, 32.1, 32.1) 32.1 >>>largest(23.44, 23.44, 23.44) 23.44arrow_forward
- The following formula can be used to determine the distance an object falls due togravity in a specific time period:d =112 gt2The variables in the formula are as follows:• d is the distance in meters,• g is 9.8,• and tis the time in seconds that the object has been falling.Write a function named fall i ngDi stance that accepts an object's falling time (in seconds)as an argument. The function should return the distance, in meters, that the object hasfallen during that time interval. Write a program that demonstrates the function by callingit in a loop that passes the values 1 through 10 as arguments and displays the return value.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
- Python 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_forwardWrite a function named kinetic that computes the kinetic energy for an object using the following formula: E = 1/2mv2 where: m is the mass of the object v is the velocity of the object E is the kinetic energy. The mass, m, and the velocity, v, are passed to the function as parameters. The value of energy, E, is computed and returnedarrow_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 = ½ m v2 The 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 kineticEnergy 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. Demonstrate the function by calling it in a program that asks the user to enter values for mass and velocity.arrow_forward
- A function can return another function. True Falsearrow_forwardWhen calling a function that takes many arguments, it is necessary to determine whether or not the order in which parameters are supplied makes a difference.arrow_forwardPlease tapy answer def question14(otherFunction): '''The parameter provided is a function. You will call this function by writing: otherFunction() Do the following: - if the result of calling otherFunction() is an int then return the negative of that value e.g. if otherFunction() returns 7 then this function should return -7 - if the result of calling otherFunction() is some other value then return the result of concatenating 'meh' and that value e.g. if otherFunction() returns 3.2 then this function should return 'meh3.2' e.g. if otherFunction() returns None then this function should return 'mehNone' - if the result of calling otherFunction() is an error then return 'uh-oh' (exactly the way I have it spelled here) ''' passarrow_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,