Writing program to convert temperature into different units


Problem1) Define the class for a type called Fraction. This class is used to represent a ration of two integers. Include mutator functions which permit the user to set numerator and the denominator. In addition, include a member function which returns the value of numerator divided by denominator as a double. Include another member function which outputs the value of the fraction reduced to lowest terms. Such as, instead of outputting 20/60 the function must output 1/3. This needs finding the greatest common divisor for the numerator and denominator, and then dividing both by that number. Embed your class in a test program.

For example, you may write a test program which asks the user for an integer numerator and integer denominator, print the real number from evaluating the fraction, and then print the fraction reduced to its lowest terms.

Enter a numerator: 20

Enter a denominator: 60

The result of your fraction is .333333.

Your fraction in lowest terms is 1 / 3.

Problem2) Create a Temperature class which internally stores a temperature in degrees Kelvin. Create functions named setTempKelvin, setTempFahrenheit, and setTempCelsius which take an input temperature in the specified temperature scale, convert the temperature to Kelvin, and store that temperature in the class member variable. Also, create functions which return the stored temperature in degrees Kelvin, Fahrenheit, or Celsius. Write the main function to test your class. Use equations shown next to convert between the three temperatures scales.

Kelvin = Celsius + 273.15

Celsius = (5.0 / 9) * (Fahrenheit – 32)

For example, you may ask the user which type of temperature he/she wishes to enter, and then output the temperature in Kelvin, Fahrenheit, and Celsius.

Which type of temperature will you like to enter (Kelvin (1), Fahrenheit(2), or Celsius(3))? 1

Enter your temperature: 20.0

Your temperature in Kelvin is 20.

Your temperature in Celsius is -253.15.

Your temperature in Fahrenheit is -423.67.

In your implementation, ensure that you include the program header in your program, also to proper indentation/spacing and other comments!

Understanding the Problem

In your own words, describe what YOU think the problem is asking you to do. In this section, document your uncertainties about problem and anything else which you feel was unclear or vague. This is to make sure that YOUR understanding matches MY understanding of the problem.

Devising a Plan/Design

At a minimum, provide the algorithm/pseudo code you designed to help solve the problem. Also, include pictures/flow charts you used to help you devise your plan, as well as any other design decisions you made such as how to manage your time, how to decompose problem, where to start first, etc. You could scan any handwritten work and attach it to the document as needed.

Looking Back/Self-Reflection

Report any checking/self-reflection you did while solving the problem. For example, how did you make sense of the output from the implementation? This includes things like using a calculator to ensure the output is accurate; testing to ensure your code runs correctly and behaves the way you expect under specific situation, using external sources of information like the internet to make sense of the results, etc.

Request for Solution File

Ask an Expert for Answer!!
Programming Languages: Writing program to convert temperature into different units
Reference No:- TGS01663

Expected delivery within 24 Hours