Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PROBLEM 1 Develop a well - documented function called convertTorque that can convert a torque from one set of units to another. For example, the

PROBLEM 1
Develop a well-documented function called convertTorque that can convert a torque from one set of units to another. For example, the function should be able to convert 100 ft-lb to 135.58 N-m.Your function should be saved in a file called convertTorque.m.Well-documented means that your code should have numerous comments explaining how the code works.
Program Requirements
1. Your function should have five input arguments, in this order: the value of the torque (a number), the current unit of force (a string), the current unit of length (a string), the desired unit of force (a string), and the desired unit of length (a string). For example, when converting 100 lb-ft to N-m, the input arguments to your function would be: convertTorque(100,"lb","ft","N","m")
The function should return two values in this order: a number indicating success (1) or failure (0) and the value of the converted torque. For example, when converting 100 lb-ft to N-m, the function should return the following two values: 1 and 135.58. Conversely, if the function is provided with invalid input, such as an invalid unit of measure, the function should return 0 and 0. For example, when converting 100 lb-ft to ft-ft, the function should return the following two values: 0 and 0.
2. The function should be able to handle four units of length: ft, in, mm, and m. It should also be able to handle four units of force: N, lb, oz, and kN. You should perform the conversion usingconditional statements. You may find it convenient to use switch statements.
3. The function should properly handle invalid input by returning a success value of0.PROBLEM 1
Develop a well-documented function called convert Torque that can convert a torque from one
set of units to another. For example, the function should be able to convert 100ft-lb to 135.58N-m.
Your function should be saved in a file called convertTorque.m. "Well-documented" means that
your code should have numerous comments explaining how the code works.
Program Requirements
Your function should have five input arguments, in this order: the value of the torque (a number), the current unit of force (a string), the current unit of length (a string), the desired unit of force (a string), and the desired unit of length (a string). For example, when converting 100lb-ft to N-m, the input arguments to your function would be: convertTorque (100,"1b","ft","N","m") The function should return two values in this order: a number indicating success (1) or failure (0) and the value of the converted torque. For example, when converting 100lb-ft to N-m, the function should return the following two values: 1 and 135.58. Conversely, if the function is
provided with invalid input, such as an invalid unit of measure, the function should return 0 and 0. For example, when converting 100lb-ft to ft-ft, the function should return the following two
values: 0 and 0.The function should be able to handle four units of length: ft, in,mm, and m. It should also beable to handle four units of force: N,lb,oz, and kN. You should perform the conversion using
con ditional statements. You may find it convenient to use switch statements. The function should properly handle invalid input by returning a success value of 0.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

American Public School Finance

Authors: William A. Owings, Leslie S. Kaplan

1st Edition

0495807834, 9780495807834

Students also viewed these Databases questions