Question

In: Computer Science

*In C++ language please* Create a table that converts temperatures from Celsius to Fahrenheit Ask the...

*In C++ language please*

Create a table that converts temperatures from Celsius to Fahrenheit

Ask the user if they would like to know today's temperatures

  • When "yes":
    • Ask or their name -Generate a random number: use the length of their name (nameLngth) to set the seed
      • Use the length of their name (nameLngth) as the starting point, and 99 as the ending point for a range of Celsius temperatures
      • Output the range of Celsius temperatures alongside the Fahrenheit temperature conversions in a table
  • When "no":
    • Output "Goodbye userName "

Hint: Run in submit mode to see the desired outputs before getting started

Celsius to Fahrenheit : Fahrenheit = Celsius *180.0 /100 + 32

Also based on the new Fahrenheit temperature output the appropriate statement below:

  • When the number is less than 55: "carry a hat and gloves"
  • When the number is less than 75: "carry a jacket"
  • When the number is less than 100: "shorts it is"

Solutions

Expert Solution

Please find the code , output below.

#include <iostream>
#include<cstdlib>
using namespace std;

int main()
{   
string ans="yes",name;
int nameLngth;
double Fahrenheit ,Celsius;
cout<<"Would you like to know today's temperatures ? ";
cin>>ans;
while(1){
if (ans=="yes"){
cout<<"Enter your name : ";
cin>>name;
nameLngth = name.length();
srand(nameLngth);
Celsius = rand() % 99 + nameLngth;
Fahrenheit= Celsius *180.0 /100 + 32;
cout<< "Today's temparature is "<<endl;
cout << "Celsius"<<"\t\t"<<"Fahrenheit"<<endl;
cout << "---------------------------------"<<endl;
cout << Celsius<<"\t\t\t"<<Fahrenheit<<endl;

if (Fahrenheit<55){
cout<< "carry a hat and gloves\n";
}   
else if (Fahrenheit>=55 && Fahrenheit<75){
cout<< "carry a jacket\n";
}
else if (Fahrenheit>=75 && Fahrenheit<100){
cout<< "shorts it is\n";
}
}
else{
cout<< "Goodbye "<<name;
exit(0);
}
cout<<"Would you like to know today's temperatures ? ";
cin>>ans;
}
return 0;
}

OUTPUT :


Related Solutions

Write a JAVA program that displays a table of the Celsius temperatures and their Fahrenheit equivalents....
Write a JAVA program that displays a table of the Celsius temperatures and their Fahrenheit equivalents.  The formula for converting a temperature from Celsius to Fahrenheit is F = 9/ 5 C + 32 where F → Fahrenheit temperature C → Celsius temperature.  Allow the user to enter the range of temperatures in Celsius to be converted into Fahrenheit.  Your program must use a loop to display the values of the temperature conversions (see sample output). Sample...
Instructions Write a program in C# that converts a temperature given in Fahrenheit to Celsius. Allow...
Instructions Write a program in C# that converts a temperature given in Fahrenheit to Celsius. Allow the user to enter values for the original Fahrenheit value. Display the original temperature and the formatted converted value. Use appropriate value returning methods for entering (input), calculating, and outputting results.
At what temperatures values are the following scales the same? (a) The Fahrenheit and the Celsius   ...
At what temperatures values are the following scales the same? (a) The Fahrenheit and the Celsius    (b) The Celsius and the Kelvin     (c) The Fahrenheit and the Kelvin  
Create a table in C of conversion from Celsius to Rankin. Allow the user to enter...
Create a table in C of conversion from Celsius to Rankin. Allow the user to enter the starting temperature and increment between lines. Print 25 lines in the table. Rankin = 9/5(Celsius + 273.15)
Write a javascript program according to the follow requirements: Create a function that converts Fahrenheit to...
Write a javascript program according to the follow requirements: Create a function that converts Fahrenheit to Celsius. It takes a single argument which represents degrees in Fahrenheit. It converts it and returns the degrees in Celsius. Create another function that converts Celsius to Fahrenheit. It takes a argument in Celsius and returns the degrees in Fahrenheit. Implement the function convert(isFtoC, from, to) below. It takes the following three arguments: isFtoC: a boolean that is true if degrees must be converted...
Write a program that displays a temperature conversion table for degrees Celsius and degrees Fahrenheit. The...
Write a program that displays a temperature conversion table for degrees Celsius and degrees Fahrenheit. The table should include rows for all temperatures between 0 and 100 degrees Celsius that are multiples of 10 degrees Celsius. Include appropriate headings on your columns. The formula for converting between degrees Celsius and degrees Fahrenheit can be found on the internet. Python 3
Temperature Converter Create a temperature conversion program that will convert the following to Fahrenheit: Celsius Kelvin...
Temperature Converter Create a temperature conversion program that will convert the following to Fahrenheit: Celsius Kelvin Newton Your program should take a character which represents the temperature to convert from and a value to be converted to using the following specification: C - Celsius K - Kelvin N - Newton In addition your program should take in the following character to exit the program: X - eXit the program The numeric input for your program should be of type double....
Using (C programming language) Create a health monitoring program, that will ask user for their name,...
Using (C programming language) Create a health monitoring program, that will ask user for their name, age, gender, weight, height and other health related questions like blood pressure and etc. Based on the provided information, program will tell user BMI, blood pressure numbers if they fall in healthy range or not and etc. Suggestions can be made as what should be calorie intake per day and the amount of exercise based on user input data. User should be able to...
Write a function in bash that takes an input temperature (Celsius or Fahrenheit) from the user...
Write a function in bash that takes an input temperature (Celsius or Fahrenheit) from the user converts that temperature Celsius to Fahrenheit, Fahrenheit to Celsius, Celsius to Kelvin and Fahrenheit to Kelvin
Language: C# Create a new Console Application. Your Application should ask the user to enter their...
Language: C# Create a new Console Application. Your Application should ask the user to enter their name and their salary. Your application should calculate how much they have to pay in taxes each year and output each amount as well as their net salary (the amount they bring home after taxes are paid!). The only taxes that we will consider for this Application are Federal and FICA. Your Application needs to validate all numeric input that is entered to make...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT