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

For this questions you have to create a program that converts a given Farenheit

ID: 3543066 • Letter: F

Question

For this questions you have to create a program that converts a given Farenheit temperature to one of the following( centigrade, kelvin, rankine, newton, delisle, reaumur, or romer) as selected by the user of the program. This program has to be typed using

if-else statements.

So far this is the code I have for this question it seems correct though it gives incorrect numbers.


#include<iostream>

using namespace std;

int main()

{

string type;

int Degrees_Farenheit;

double conversion= 0;

cout <<"Degrees Farenheit:" ;

cin >> Degrees_Farenheit;

cout << endl;

cout << "Enter type of conversion (Centigrade, Kelvin, Rankine, Newton, Delisle, Reamur, Romer) :";

cin >> type;

cout << endl;

if(type.compare("Centigrade"))

{

conversion =((Degrees_Farenheit)-32)*(.55);

}

else if(type.compare("Kelvin"))

{

conversion =(((Degrees_Farenheit)-32)*(.55))+(273);

}

else if(type.compare("Rankine"))

{

conversion =(((Degrees_Farenheit)-32)*(.55))+ (273)*(1.8);

}

else if(type.compare("Newton"))

{

conversion =(((Degrees_Farenheit)-32)*(.55))*(.33);

}

else if(type.compare("Delisle"))

{

conversion =(373.15)-((Degrees_Farenheit-32)*(.55)+273)*(1.5);

}

else if(type.compare("Reamur"))

{

conversion =((Degrees_Farenheit-32)*(.55))*(0.8);

}

else if(type.compare("Romer"))

{

conversion =(((Degrees_Farenheit)-32)*(.55))*(.525)+ (7.5);

}


cout << "Total degrees in " << type << " is " << conversion << " degrees "<< endl;

system("pause");

return 0;

}

Explanation / Answer

#include<iostream>
using namespace std;
int main()
{
string type;
int Degrees_Farenheit;
double conversion= 0;
cout <<"Degrees Farenheit:" ;
cin >> Degrees_Farenheit;
cout << endl;
cout << "Enter type of conversion (Centigrade, Kelvin, Rankine, Newton, Delisle, Reamur, Romer) :";
cin >> type;
cout << endl;
if(type.compare("Centigrade")==0)
{
conversion =((Degrees_Farenheit)-32)*(.55);
}
else if(type.compare("Kelvin")==0)
{
conversion =(((Degrees_Farenheit)-32)*(.55))+(273);
}
else if(type.compare("Rankine")==0)
{
conversion =(((Degrees_Farenheit)-32)*(.55))+ (273)*(1.8);
}
else if(type.compare("Newton")==0)
{
conversion =(((Degrees_Farenheit)-32)*(.55))*(.33);
}
else if(type.compare("Delisle")==0)
{
conversion =(373.15)-((Degrees_Farenheit-32)*(.55)+273)*(1.5);
}
else if(type.compare("Reamur")==0)
{
conversion =((Degrees_Farenheit-32)*(.55))*(0.8);
}
else if(type.compare("Romer")==0)
{
conversion =(((Degrees_Farenheit)-32)*(.55))*(.525)+ (7.5);
}
cout << "Total degrees in " << type << " is " << conversion << " degrees "<< endl;
system("pause");
return 0;
}

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