Question #251180

Write a program that prompts the user to enter a length in feet and then enter a length in inches and outputs the equivalent length in centimeters. If the user enters a negative number or a non-digit number, throw and handle an appropriate exception and prompt the user to enter another set of numbers.


Your error message should read A non positive number is entered and allow the user to try again.


Format your output with setprecision(2) to ensure the proper number of decimals for testing!


Expert's answer

void covertToCentimeter(int feet, int inches)
{
	double centimeters;
	centimeters = (((feet+(inches/12.0))*0.3048)*100) - 100;
	
	cout << "Centimeter: " << centimeters;
};

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

LATEST TUTORIALS
APPROVED BY CLIENTS