Most programs require the same logic to be repeated for several sets of data. The most efficient way to deal with this situation is to establish a looping structure in the algorithm that will cause the processing logic to be repeated a number of times The DOWHILE structure will continue to repeat a group of statements while a condition remains true.

In this scenario, every day, a metal lab receives 15 temperature readings of boiled metal expressed in degrees Fahrenheit. A program needs to be written that will accept each Fahrenheit temperature, convert it to Celsius and display the converted temperature to the screen. After 15 temperatures have been processed, the message ‘All temperatures processed’ is to be displayed on the screen.

You need to write a C++ program that converts Fahrenheit to Celsius and follows the guidelines in this handout. For up to 25 extra credit points (not good towards exams) provide a user menu option to convert from Fahrenheit to Celsius and Celsius to Fahrenheit (see sample code below).

It is also time to start adding comments to your code. Please make sure that you put the appropriate comments in your code (see sample below).

In this project, the programmer will need (notes):

  • a DOWHILE structure to repeat the necessary processing
  • a counter, called temperature_count, initialised to zero, that will control the 15 repetitions.
  • The temperature_count variable is initialised before the DOWHILE condition is executed.
  • As long as temperature_count is less than 15 (that is, the DOWHILE condition is true), the statements between DOWHILE and ENDDO will be executed.
  • The variable temperature_count is incremented once within the loop, just before the ENDDO delimiter (that is, just before it is tested again in the DOWHILE condition).
  • After 15 iterations, temperature_count will equal 15, which causes the DOWHILE condition to become false and control to be passed to the statement after ENDDO.
  • Loop should repeat the necessary processing, When to stop? Usage of counter. tempt_count = 0, this will control the 15 repetitions

How do you convert between Fahrenheit and Celsius temperature? c_temp = (f_temp – 32) * 5 / 9

To convert from Farenheit to Celsius, use this equation:

C=(F-32) x 5/9

To convert from Celsius to Farenheit, use this equation:

F=(C x 9/5) + 32

USE YOUR HEAD

Here's a trick for converting Celsius to Farenheit in your head:

  • double the Celsius temperature
  • subtract one tenth of this value
  • add 32

EXAMPLE: let's use 30 degrees C as an example.

  • double the Celsius temperature (2 x 30 = 60)
  • subtract one tenth of this value (60 - 6 = 54)
  • add 32 (54 + 32 = 86 degrees F)

Use this web site to see conversion charts.

http://www.weatherquestions.com/How_do_you_convert_temperature.htm

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.