CAN YOU HELP ME TO DO THIS EXERCISE PLEASE USING C++
Write a program that gives the user two options:
(1) Transform a temperature value from Celsius to
Fahrenheit or
(2) Transform a temperature value to Fahrenheit to
Celsius.
The two options are communicated to the user by the console by means of "cout" with this text:
"If you want to transform from Fahrenheit to Celsius
between character C (capital)."
"If you want to transform from Celsius to Fahrenheit between the
character F (capital)."
After the user defines the temperature transformation option they
want, type [ENTER]. And then enter the value of the temperature you
want to transform.
The formula for the transformation is:
F = (0.9/5.0)*C+32.0;
Use and develop this key:
class TempUnitConversion{
private:
float celcius;
float farenheit;
public:
float getFarenheit(){
returnfarenheit;
}
void setFarenheit(float readFarenheit){
farenheit=readFarenheit;
}
float getCelcius(){
return celcius;
}
void setCelcius(float readCelcius){
celcius=readCelcius;
}
void changeCelciusToFarenheit(){
}
void changeFarenheitToCelcius(){
}
};
Each of these methods has to be used in the duty so that the duty is correctly done.
The main () function is used exclusively for the following:
(1) Instance an instance of the TempUnitConversion
class
(2) Receive the user's entries to determine:
(a)From what unit of temperature to which unit of
temperature does the user transformation want to make.
(b)The calculation value made by the instance of the
TempUnitConversion class
(3) The output of the calculation made by the instance of
the TempUnitConversion class
Program:
//header file
#include<iostream>
using namespace std;
//class declaration
class TempUnitConversion{
//variable declaration
private:
float celcius;
float farenheit;
//method declaration and definition
public:
float getFarenheit(){
return
farenheit;
}
void setFarenheit(float
readFarenheit){
farenheit=readFarenheit;
}
float getCelcius(){
return
celcius;
}
void setCelcius(float
readCelcius){
celcius=readCelcius;
}
void
changeCelciusToFarenheit(){
farenheit =
celcius * 9.0/5.0 + 32;
cout<<"Fahreinheit value for "<< celcius <<"
Celsius is: " <<farenheit;
}
void
changeFarenheitToCelcius(){
celcius =
(farenheit - 32) * 5.0/9.0;
cout<<"Celsius value for "<< farenheit <<"
Fahrenheit is: " <<celcius;
}
//end of the class
};
//defining main function
int main(){
//declaring required variable
float cls,frt;
char choice;
//creating test object
TempUnitConversion ob;
//asking for user input
cout<<"Choose C (Fahrenheit to celsius) or F
(Celsius to Fahrenheit):";
cin>>choice;
//checking for the user request and calling the
temperature transformation
if(choice=='C'){
cout<<"Enter Fahrenheit value
to transform to celsius: ";
cin>>frt;
ob.setFarenheit(frt);
ob.changeFarenheitToCelcius();
}
else if(choice=='F'){
cout<<"Enter Celsius value to
transform to Fahrenheit: ";
cin>>cls;
ob.setCelcius(cls);
ob.changeCelciusToFarenheit();
}
else{
cout<<"The option choosen is
not correct";
}
//end of main function
}
Output:
CAN YOU HELP ME TO DO THIS EXERCISE PLEASE USING C++ Write a program that gives...
Can
you help me to create this program, please?
Prompt the user for the user for a number of degrees in Fahrenheit as an int. That number should be passed to a function named ffocREFO. This function will do the necessary calculation to convert the passed temperature to degrees Celsius as a double. The function MUST have a void return type and have the following prototype: void ffccREF(double& celsius, int Faren); In your main, display both the entered temperature and...
Write a program in C++ that gives the temperature of earth at a depth. It must be in C++ and follow the information below: Problem description Write a program to take a depth in kilometers inside the earth as input data; calculate and display the temperature at this depth in both degrees Celsius and degree Fahrenheit. The formulas are: Celsius temperature at depth in km: celsius = 10 x depth(km) + 20 Convert celsius to fahrenheit: fahrenheit = 1.8 x...
Write a C++ program that prompts a user to enter a temperature in Fahrenheit as a real number. After the temperature is entered display the temperature in Celsius. Your program will then prompt the user if they want to continue. If the character n or N is entered the program will stop; otherwise, the program will continue. After your program stops accepting temperatures display the average of all the temperatures entered in both Fahrenheit and Celsius. Be sure to use...
B - Temperatures You may use the CodeCheck IDE directly to write this program. (Your program will be graded by CodeCheck). Here are the requirements: Complete the class Temperatures (you must use this exact name to pass CodeCheck) so that it prompts the user for a temperature value, followed by a character that represents the type of temperature. The second input value is the string "F" for Fahrenheit or "C" for Celsius. If the string is an "F", the temperature...
C# Temp. Converter program.
Create a Celsius and Fahrenheit Temperature Converter
application. The application must have 2 Labels (each one of them
assigned only to Celsius and Fahrenheit), 2 TextBoxes (each one of
them assigned only to Celsius and Fahrenheit), only 1 Convert
Button, 1 Clear Button, and 1 Exit Button. Also, 1 Error message
label which will display the error messages.
The application should only allow the user to enter the
desired temperature just in one of the TextBoxes...
FOR PYTHON Write a Python program that can convert a Fahrenheit temperature to Celsius, or vice versa. The program should use two custom functions, f_to_c and c_to_f, to perform the conversions. Both of these functions should be defined in a custom module named temps. Custom functionc_to_f should be a void function defined to take a Celsius temperature as a parameter. It should calculate and print the equivalent Fahrenheit temperature accurate to three decimal places. Custom function f_to_c should be a...
Write a Python program that can convert a Fahrenheit temperature to Celsius, or vice versa. The program should use two custom functions, f_to_c and c_to_f, to perform the conversions. Both of these functions should be defined in a custom module named temps. Custom function c_to_f should be a void function defined to take a Celsius temperature as a parameter. It should calculate and print the equivalent Fahrenheit temperature accurate to three decimal places. Custom function f_to_c should be a value-returning...
Write a Python program that can convert a Fahrenheit temperature to Celsius, or vice versa. The program should use two custom functions, f_to_c and c_to_f, to perform the conversions. Both of these functions should be defined in a custom module named temps. Custom function c_to_f should be a void function defined to take a Celsius temperature as a parameter. It should calculate and print the equivalent Fahrenheit temperature accurate to three decimal places. Custom function f_to_c should be a value-returning...
C# Temperature Converter Application:
I have most of the application complete I just need only
help with error messages.
My instructor wants me to show four error messages
inside an error message label (not a message box) and all of the
error messages should appear inside error message label. The four
error messages should appear when:
1: User enters data inside both Celsius and fahrenheit
text boxes: “You should enter data in only one textbox. Press Clear
to start over.”...
Write a single C++ program that performs the following conversion (The modulus divide will help you get the remainder as shown in class) 39 / 12 = 3 and 39 % 12 = 3, so 3 feet 3 inch(es) Height conversion 1 meter = 39 inches 12 inches = 1 foot Ask/Prompt the user to enter in the height in meters, convert and output the result in feet and inches Example 1 meters as input should produce 3 feet (foot)...