Purchase Solution

function convert Length

Not what you're looking for?

Ask Custom Question

Write a function convertLength() that receives a real value and two strings inUnits and outUnits, then converts the value given in inUnits to the equivalent metric value in outUnits and displays this value. The function should carry out the following conversions:
inUnits outUnits
I c (inches to centimeters; 1 in. = 2.54001 cm)
F c (feet to centimeters; 1 ft = 30.4801cm)
F m (feet to meters; 1 ft = 0.304801 m)
Y m (yards to meters; 1 yd = 0.914402 m)
M k (miles to kilometers; 1 mi = 1.60935 km)

Also write a driver program to test your function. What happens if you enter units other than those listed?

Purchase this Solution

Solution Summary

Write a function convertLength() that receives a real value and two strings inUnits and outUnits, then converts the value given in inUnits to the equivalent metric value in outUnits and displays this value.

Purchase this Solution


Free BrainMass Quizzes
Excel Introductory Quiz

This quiz tests your knowledge of basics of MS-Excel.

Inserting and deleting in a linked list

This quiz tests your understanding of how to insert and delete elements in a linked list. Understanding of the use of linked lists, and the related performance aspects, is an important fundamental skill of computer science data structures.

Basic Networking Questions

This quiz consists of some basic networking questions.

Basic Computer Terms

We use many basic terms like bit, pixel in our usual conversations about computers. Are we aware of what these mean? This little quiz is an attempt towards discovering that.

C# variables and classes

This quiz contains questions about C# classes and variables.