Question

C++ Exercise 1: Problem Specification: Code the IPO Charts shown below for main function, getFahrenheit function,...

C++ Exercise 1:

Problem Specification:

Code the IPO Charts shown below for main function, getFahrenheit function, and calcCelsius function. Enter your C++ instructions into a source file named yourLastName_U5W1_EX1.cpp. Enter any appropriate comments in your code. Display the Celsius temperature in fixed-point notation with no decimal places. Save and then run the program. Test the program using the following, Fahrenheit temperatures: 32 and 212.

Hints for handling this assignment:

  • Do not skip on the learning process. Read the chapters carefully and watch the Value Returning Functions video carefully located at the bottom of the Moodle course. Pay close attention to how the code is set up. Watch it multiple times as needed.
  • For this assignment you should have three functions: the main function, a function to get the Fahrenheit temperature from the user, and a function to calculate the Celsius temperature.
  • The main function should call the function that gets the Fahrenheit temperature from the user and returns it. The main function should then call the function that calculates Celsius passing the Fahrenheit temperature to it. Once that function calculate the Celsius temperature it should return it to the main function. Main() should then display the Celsius temperature.
  • All variables should be local variables. You must understand variable scope and how to pass values from one function to another. If you don’t understand this, you will not understand this assignment.

Hints for getting a higher grade:

  • Notice the variable names, data types, and function names are intentionally provided in the code. If you don’t use the right ones, you won’t get the answers correct on the submission.
  • You must know the correct terminology in order to provide the correct answers on the submission, such as Function prototype, Function call, and function header.
  • Test your code and make sure it’s working correctly before starting the submission questions. Copy your code from the C++ editor rather than Word so the quotes and minus symbols are the correct ones rather than the fancy ones from Word.

Main Function

IPO Chart Information

C++ Instructions

Input:

   Fahrenheit temperature

double fahrenheit = 0.0;

Processing:

   none

Output:

   Celsius temperature

double celsius = 0.0;

Algorithm:

  1. call getFahrenheit to get the Fahrenheit temperature
  1. call calcCelsius to calculate the Celsius temperature, pass the Fahrenheit temperature
  1. display the Celsius temperature (in fixed-point notation with no decimal places)

getFahrenheit Function

IPO Chart Information

C++ Instructions

Input:

   Fahrenheit temperature

double fahrenheitTemp = 0.0;

Processing:

   none

Return Output:

   Fahrenheit temperature

Algorithm:

  1. Enter the Fahrenheit temperature

cout << “Enter temperature in Fahrenheit”;

  1. Return the Fahrenheit temperature

calcCelsius Function

IPO Chart Information

C++ Instructions

Input:

   Fahrenheit temperature

   (as formal parameter)

double fahrenheitTemp

Processing:

   none

Return Output:

   Celsius temperature

double celsiusTemp = 0.0;

Algorithm:

  1. Celsius temperature = 5.0 / 9.0 * (Fahrenheit temperature – 32.0)
  1. Return the Celsius temperature

Copy Your Code Here:

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Thanks for the question. Below is the code you will be needing. Let me know if you have any doubts or if you need anything to change.

If you are satisfied with the solution, please rate the answer. Let me know for any help with any other questions.

Thank You !
===========================================================================

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

double getFahrenheit (){
   double fahrenheitTemp = 0.0;
   cout << "Enter temperature in Fahrenheit: ";
   cin>>fahrenheitTemp;
   return fahrenheitTemp;
}

//Return the Celsius temperature
double calcCelsius(double fahrenheitTemp){
   double celsiusTemp = 0.0;
   celsiusTemp = 5.0*(fahrenheitTemp-32)/9.0;
   return celsiusTemp;

}

int main(){

   double fahrenheit = 0.0;
   double celsius = 0.0;
   fahrenheit = getFahrenheit();
   celsius = calcCelsius(fahrenheit);
   cout<<fixed<<showpoint<<setprecision(2);
   cout<<"Temperature in Celsius Scale: "<<celsius<<endl;
  
  
   return 0;
}
=====================================================================

Add a comment
Know the answer?
Add Answer to:
C++ Exercise 1: Problem Specification: Code the IPO Charts shown below for main function, getFahrenheit function,...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT