Question

In: Computer Science

Use C++ to create an application that provide the menu with two options TemperatureConverter_Smith.cpp MENU CONVERTER...

Use C++ to create an application that provide the menu with two options

TemperatureConverter_Smith.cpp

MENU CONVERTER TEMPERATURE – JAMES SMITH

  1. Convert Fahrenheit temperature to Celsius
  2. Convert Celsius temperature to Fahrenheit
  1. Exit

CASE 1: Convert Fahrenheit temperature to Celsius

-Display the message to ask to enter Fahrenheit degree from the keyboard

-Use the following formula to convert to Celsius degree

        Celsius Temperature = (Fahrenheit Temperature – 32) * 5/9 ;

-Display the output as below:

TemperatureConverter_Smith.cpp

TEMPERATURE CONVERTER – JAMES SMITH

Input temperature in Fahrenheit:              86

Temperature in Celsius:                               30

CASE 2: Convert Celsius temperature to Fahrenheit

-Display the message to ask to enter Celsius degree from the keyboard

-Use the following formula to covert to Fahrenheit degree:

                Fahrenheit Temperature = 9/5 * Celsius Temperature + 32;

-Display the output as below:

TemperatureConverter_Smith.cpp

TEMPERATURE CONVERTER – JAMES SMITH

Input temperature in Celsius:                     30

Temperature in Fahrenheit:                        86

Solutions

Expert Solution

Source Code:

Output:

Code in text format (See above images of code for indentation):

#include <iostream>
using namespace std;
/*main function*/
int main()
{
   /*variables*/
   double f,c,temp;
   int opt;
   while(1)
   {
       /*dispaly menu*/
       cout<<"\nMENU CONVERTER TEMPERATURE - JAMES SMITH"<<endl;
       cout<<"Convert Fahrenheit temperature to Celsius"<<endl;
       cout<<"Convert Celsius temperature to Fahrenheit"<<endl;
       cout<<"Exit\n"<<"Choose your option: ";
       /*read option from user*/
       cin>>opt;
       switch(opt)
       {
           /*case 1 fahrenheit to celsius*/
           case 1:
               cout<<"TEMPERATURE CONVERTER - JAMES SMITH"<<endl;
               cout<<"Input temperature in Fahrenheit:\n";
               /*read temperature in fahrenheit*/
               cin>>f;
               /*convert to celsius*/
               c=(f-32)*5/9;
               cout<<"Temperature in Celsius:\n"<<c<<endl;
               break;
           /*case 2 celsius to fahrenheit*/
           case 2:
               cout<<"TEMPERATURE CONVERTER - JAMES SMITH"<<endl;
               cout<<"Input temperature in Celsius:\n";
               /*read temperature in celsius*/
               cin>>c;
               /*convert to Fahrenheit*/
               f=(9*c)/5+32.0;
               cout<<"Temperature in Fahrenheit:\n"<<f<<endl;
               break;
           /*case 3 to exit*/
           case 3:
               exit(0);
           /*default for invalid options*/
           default:
               cout<<"You entered invalid option!"<<endl;
       }
   }
return 0;
}


Related Solutions

Use a switch statement to create a menu with the following options Create a Camping Trip...
Use a switch statement to create a menu with the following options Create a Camping Trip Assign a Camper to a Trip Create a Needed Food item Assign a Camper to a Food item For now just print a message prompting user for input and allowing them to return the menu. No functionality is required at this time, but save this code for later use.
Create a menu in Java. A menu is a presentation of options for you to select....
Create a menu in Java. A menu is a presentation of options for you to select. You can do this in the main() method. 1. Create a String variable named menuChoice. 2. Display 3 options for your program. I recommend using 3 System.out.println statements and a 4th System.out.print to show "Enter your Selection:". This needs to be inside the do -- while loop. A. Buy Stock. B. Sell Stock X. Exit Enter your Selection: 3. Prompt for the value menuChoice....
create a menu in Java. A menu is a presentation of options for you to select....
create a menu in Java. A menu is a presentation of options for you to select. The article above that is in our discussion board may be helpful. You can do this in the main() method. 1. Create a String variable named menuChoice. 2. Display 3 options for your program. I recommend using 3 System.out.println statements and a 4th System.out.print to show "Enter your Selection:". This needs to be inside the do -- while loop. A. Buy Stock. B. Sell...
Class, Let's create a menu in Java. A menu is a presentation of options for you...
Class, Let's create a menu in Java. A menu is a presentation of options for you to select. You can do this in the main() method. 1. Create a String variable named menuChoice. 2. Display 3 options for your program. I recommend using 3 System.out.println statements and a 4th System.out.print to show "Enter your Selection:". This needs to be inside the do -- while loop. A. Deposit Cash. B. Withdraw Cash X. Exit Enter your Selection: 3. Prompt for the...
Create a simple C++ application that will exhibit concurrencyconcepts. Your application should create two threads...
Create a simple C++ application that will exhibit concurrency concepts. Your application should create two threads that will act as counters. One thread should count up to 20. Once thread one reaches 20, then a second thread should be used to count down to 0. For your created code, provide a detailed analysis of appropriate concepts that could impact your application. Specifically, address:Performance issues with concurrencyVulnerabilities exhibited with use of stringsSecurity of the data types exhibited.
C++ Write a menu based program for the pet rescue. There should be 2 menu options...
C++ Write a menu based program for the pet rescue. There should be 2 menu options -Add a pet -View pets -If the user chooses option 1, you will open a data file for writing without erasing the current contents, and write a new pet record to it. The file can be formatted any way that you choose but should include the pet's name, species, breed, and color. You my also include any additional information you think is appropriate. -If...
Use menu based functionality and validation loops to create a new customer bonus fruit package application...
Use menu based functionality and validation loops to create a new customer bonus fruit package application for the Dirt to Dish discount produce company. The program you create will prompt the user to enter a number to select one of three bonus pack options: 1 for Apple pack 2 for Orange pack 3 for Banana pack **Use input validation to ensure a valid option has been selected before proceeding. Use variables to keep track of how many of each fruit...
Write a menu-driven C++ program with two options: 1) Is it odd or even? 2) End...
Write a menu-driven C++ program with two options: 1) Is it odd or even? 2) End Program.The user can only input a positive integer (0 does not count) and if the input is not a positive integer the program must state "Invalid Input." The program must determine whether the input is even or odd. The program must use functions and can only use the iostream and iomanip libraries. Note: The program must loop until the 2nd menu option is chosen.
Create a C++ application that will exhibit concurrency concepts. Your application should create two threads that will act as counters.
C++Create a C++ application that will exhibit concurrency concepts. Your application should create two threads that will act as counters. One thread should count up to 20. Once thread one reaches 20, then a second thread should be used to count down to 0.
Create a C++ application that will exhibit concurrency concepts. Your application should create two threads that will act as counters.
C++ application:Create a C++ application that will exhibit concurrency concepts. Your application should create two threads that will act as counters. One thread should count up to 20. Once thread one reaches 20, then a second thread should be used to count down to 0.For your created code, provide a written analysis of appropriate concepts that could impact your application.Please Specifically, Address: Performance Issues with Concurrency Vulnerabilities Exhibited with use of Strings and Security of the Data Types used.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT