Question
Please i need someone to help me complete this assignment blow, thank you ASSIGNMENT 1 as per c+++ Assignment-mc1.cpp:main project file. #include stdafx.h #include using
Please i need someone to help me complete this assignment blow, thank you
ASSIGNMENT 1 as per c+++
Assignment-mc1.cpp:main project file.
#include "stdafx.h"
#include
using namespace std;
float convertToFah(float ce)
{
return ce*9/5+32;
}
float convertToCel(float fah)
{
return (fah-32)*5/9;
}
void manu()
{
int choice=0;
float value;
cout << "Enter 1 to convert from Fahrenheit to Celcius and 2 to convert Celsius to Fahrenheit" << endl;
cin >> choice;
switch(choice)
{
case 1:
cout << "Enter the value in Fahrenheit:";
cin >> value;
cout << "The value in celsius is " << convertToCel(value) << endl;
break;
case 2 :
cout << "Enter the value in Celsius:";
cin >> value;
cout << " The value in Fahrenheit is "<< convertToFah(value) << endl;
break;
default: break;
}
}
int main()
{
int ch;
do {
cout << "Enter 1 to do the conversions 2 to quit:";
cin >> ch;
} while(ch == 1);
return 0;
}
Take Assignment 1 above and modify it. If the user enters a non digit number, throw and handle the appropriate exception and prompt the user to enter the number again.
Directions - You are going to convert temperatures in this program. You will give the user the choice of converting Fahrenheit to Celsius or Celsius to Fahrenheit. With the correct answer you will also display the number entered. The user should have the option to convert as many temperatures as they want. Use functions and a menu and, assume they will convert at least one temperature.
the formulas are:
centigrade = (fahrenheit - 32) * 5/9 fahrenheit = centigrade * 9/5 + 32 the brains behind:
Anders Celsius, Swedish physicist and astronomer, 1701 - 1744 Gabriel Fahrenheit, German physicist, 1686 - 1736, inventor of the thermometer how did they choose the ranges?
CELSIUS: range of 100 steps, 0 degree Centigrade = freezing point of water, 100 degree Centigrade = boiling point of water
FAHRENHEIT: range of 180 steps, 32 degree Fahrenheit = freezing point of water, 100 degree Fahrenheit = body temperature of a person (not very accurate...), 212 degree Fahrenheit = boiling point of water
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started