(General math) a. Write a function named rightTriangle() that accepts the lengths of two sides of a right triangle as the arguments a and b. The subroutine should determine and return the hypotenuse, c, of the triangle.
b. Include the function written for Exercise 4a in a working
Trending nowThis is a popular solution!
Chapter 6 Solutions
C++ for Engineers and Scientists
- I need the answer as soon as possiblearrow_forwardUse Clojure: a. Write a function is-it-four? that returns true when given the number 4, and returns false otherwise. b. Define a function func and an expression expr such that the following evaluates to true.(= 3 (apply func expr))arrow_forward(Wattan Corporation) is an Internet service provider that charges customers a flat rate of $7.99 for up to 10 hours of connection time. Additional hours or partial hours are charged at $1.99 each. Write a function charges that computes the total charge for a customer based on the number of hours of connection time used in a month. The function should also calculate the average cost per hour of the time used (rounded to the nearest 0.01), so use two output parameters to send back these results. You should write a second function round_money that takes a real number as an input argument and returns as the function value the number rounded to two decimal places. Write a main function that takes data from an input file usage.txt and produces an output file charges.txt. The data file format is as follows: Line 1: current month and year as two integers Other lines: customer number (a five-digit number) and number of hours used Here is a sample data file and the corresponding output file:…arrow_forward
- (Wattan Corporation) is an Internet service provider that charges customers a flat rate of $7.99 for up to 10 hours of connection time. Additional hours or partial hours are charged at $1.99 each.Write a function charges that computes the total charge for a customer based on the number of hours of connection time used in a month. The function should also calculate the average cost per hour of the time used (rounded to the nearest 0.01), so use two output parameters to send back these results.You should write a second functionround_money that takes a real number as an input argument and returns as the function value the number rounded to two decimal places. Write a main function that takes data from an input file usage.txt and produces an output file charges.txt. The data file format is as follows:Line 1: current month and year as two integersOther lines: customer number (a five-digit number) and number of hours usedHere is a sample data file and the corresponding output file:Data file…arrow_forward1. (Based on Problem 3-2) Indicate, for each pair of functions (f,g) in the table below, whether f(n) is O, O, or of g(n). Your answer should be in the form of "yes" or "no" f each box; you do not need to show any other work. f(n)=O(g(n)) f(n)=O(g(n)) f(n)=2(g(n)) f(n) 5n-78 29n² 7n + n*lg(n) 2⁰ n's g(n) 3lg(n) + 2 0.5'n! 9n*lg(n) + 12 100n7 n'lg(n)arrow_forward(Practice) The volume, v, and side surface area, s, of a cylinder are given by these formulas: v=r2ls=2rl r is the cylinder’s radius, and l is its length. Using these formulas, write and test a function named cylinder() that accepts a cylinder’s radius and length and returns its volume and side surface area.arrow_forward
- 2-Determine the output of the following functions (You must show your works) c. (cdaaddaar '(((orange grape ((() apple () ()) banana))) apple banana)) Written explanation requiredarrow_forwardPlease give me correct solution.arrow_forwardAnswer the following questions.A) the "Taylor series" stands for (MacLaurin series stands for) around the zero point of the function e^x is attached. In the form is found with the consecutive Sum expression.Accordingly, for the value x entered from the keyboard, write the flow diagram of the program that calculates e^x by opening it in a series up to the number of terms (N) entered from the keyboard. B) integers whose initial and final spelling are the same are called palindromes. Draw the program's flow diagram listing palindrome numbers from 100 to 9999.arrow_forward
- c=3arrow_forwardPlease use MATLAB to solve the problem.arrow_forwardRedo the program given where you have to define and use the following functions: (a) isTriangle - takes 3 sides of a triangle and returns true if they form a triangle, false otherwise. (b) isIsosceles - takes 3 sides of a triangle and returns true if they form an isosceles triangle, false otherwise. (c) isEquilateral - takes 3 sides of a triangle and returns true if they form anequilateral triangle, false otherwise. (d) isRight - takes 3 sides of a triangle and returns true if they form a right triangle, false otherwise. (e) your program should run continuous until the user wants to quit The given program: #include <iostream> #include <cmath> using namespace std; // Constant Declarations const double E = .0001; int main() { double side1, side2, side3; bool isTriangle, isRight, isEquilateral, isIsosceles; cout << "Enter the lengths of the 3 sides of a triangle -- "; cin >> side1 >> side2 >> side3; isTriangle = side1 + side2 > side3 &&side1…arrow_forward
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr