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
Problem Comments
-
2 Comments
wah nice one!
So many test cases!
Solution Comments
Show commentsProblem Recent Solvers141
Suggested Problems
-
Project Euler: Problem 1, Multiples of 3 and 5
3156 Solvers
-
588 Solvers
-
Is this triangle right-angled?
5780 Solvers
-
304 Solvers
-
497 Solvers
More from this Author19
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!