Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This set of problems involves converting a value in a one unit to a value in ano

ID: 662958 • Letter: T

Question

This set of problems involves converting a value in a one unit to a value in another unit. Each program should prompt the user for a value in the specified units and then print the converted value along with the new units. Save each program separately in one folder, zip up the folder and turn it in on Blackboard/Learn under the Extra Credit Conversions Ch2 assignment. Add error checking to each exercise below for an added 0.5 points credit (0.5 points total, not 0.5 points each).

Write a program to converts miles to kilometers. ( 1 mile = 1.6093440 km ) Ask the user for the number of miles including decimal values.

Write a program to converts meters to miles. Ask the user for the number of meters including decimal values. Print your output in scientific notation using the proper conversion specifier in your printf statement. ( 1 m = 0.00062137119 miles )

Write a program to converts pounds to kilograms. Ask the user for the number of pounds including decimal values. ( 1 kg = 2.205 lbs. )

Write a program to convert Newtons to pounds. Ask the user for the Newtons including decimal values. ( 1 lb. = 4.448 N )

Write a program that converts degrees Fahrenheit (Tf) to degrees Rankin (Tr). (Tf = Tr

Explanation / Answer

1. Miles to Km

=====================
#include <iostream> //inclusion of support for doing input & output
using namespace std; //declare access to standard stuff like cin, cout
int main()   
{
double KM_PER_MILE = 1.609; // for storing a constant: 1.609 km equals a mile
double miles; // for storing the input data: distance in miles
double kms; // for storing the result: distance in kilometers
   cout << "What is the distance in miles?" << endl;
cin >> miles;
cout << "The distance in miles is " << miles << endl;
kms = KM_PER_MILE * miles;
cout << "The distance in kilometers is " << kms << endl << endl;
return 0;
}

2. Meters to miles

===============

#include <iostream.h>
using namespace std;

#define MILE 0.000621371

int main()
{
double meter;
cout << "Enter meters: ";
cin >> meter;
cout << endl << meter << " meter(s) in miles = " << meter * MILE << endl;

return 0;
}


3.Pounds to KG
========================
#include <iostream>

using namespace std;
int main()
{
float kg, pound;
cout<<"Enter your weight in pounds: ";
cin>> pound;
cin.ignore();
kg = pound / 2.20462262184878;
cout<<"Your weight in kg:"<< kg << " kg.";
return 0;
}

4. Newtons to pounds
===========================
#include <iostream>

using namespace std;
int main()
{
float Newton, pound;
cout<<"Enter your weight in Newton: ";
cin>> newton;
cin.ignore();
pound = newton * 0.224808942443;
cout<<"Your weight in pound:"<< pound << "Pound";
return 0;
}

5. Fahrenheit (Tf) to degrees Rankin
==========================
1 degree Fahrenheit = 460.67 degree Rankine

#include <iostream>
using namespace std;
int main()
{
double F!, R1;

cout << "Temperature in Fahrenhei" << endl;
cin >> F1;
cout << Fahrenheit to Rankin" << endl;
R1 = F1*460.67;
cout << "Temperature Fahrenheit is" << endl;
cout << R1 << "deg Rankin" << endl;

return 0;
}

6. Celsius (Tc) to degrees Rankin
=============================
R = (C + 273.15)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote