Computer as a Problem solving tool : Page 15, Exercises 1 - 3
Write a program that asks the user to enter a length in centimeters. If the user enters a negative length, the program should tell the user that the entry is invalid. Otherwise, the program should convert the length to inches and print out the result.
There are 2.54 centimeters in an inch.
Write a program that asks the user for a temperature. Then asks them what units ( Celsius or Fahrenheit ) the temperature is in. Your program should convert thet temperature to the other unit.
The conversions are;
- F = (temp * 1.8) + 32
- C = (temp - 32) / 1.8
Write a program that asks the user to enter a temperature in celsius.
The program should print the following messages based on the temperature;
- If the temperature is less than -273.15, print that the temperature is invalid because it is below absolute zero.
- If it is exactly -273.15, print that the temperature is absolute 0.
- If the temperature is between -273.15 and 0, print that the temperature is below freezing.
- If it is 0, print that the temperature is at the freezing point.
- If it is between 0 and 100, print that the temperature is in the normal range.
- If it is 100, print that the temperature is at the boiling point.
- If it is above 100, print that the temperature is above the boiling point.