Problem 45392. Convert a temperature reading from Celsius to an unknown scale

Two of the most famous temperature scales are the Celsius and the Fahrenheit scale. In reality, however, there are so many other temperature scales used in the chemical industry.

Let's assume that all temperature conversions are of the form Y = AX + B where A and B are conversion constants, and X and Y are the temperature readings. If you are given two sample conversions from one scale to another, then you can convert any other value to and from that scale with this assumption. Take the Rankine scale for example. If we know that 476.85 degrees Celsius converts to 1350 degrees Rankine and 226.85 degrees Celsius converts to 900 degrees Rankine, then we can compute that 40 degrees Celsius is equal to 563.67 degrees Rankine.

Make a program that accepts 5 decimal numbers X1, Y1, X2, Y2, and T. Let’s name a new temperature scale 'Franklin'. If X1 degrees Celsius convert to Y1 degrees Franklin and X2 degrees Celsius convert to Y2 degrees Franklin, output a decimal number, rounded to 2 decimal places, denoting the degrees Franklin equivalent of T degrees Celsius. You are guaranteed that:

  • All inputs are in the range [-1000, 1000].
  • Each test case is valid and has a unique solution.

Solution Stats

34.45% Correct | 65.55% Incorrect
Last Solution submitted on Jun 03, 2024

Problem Comments

Solution Comments

Show comments

Problem Recent Solvers138

Suggested Problems

More from this Author19

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!