Question: Design and implement an application to convert temperatures from Fahrenheit to Celsius or Celsius to Fahrenheit. Create a menu based application with 3 options, Convert

Design and implement an application to convert temperatures from Fahrenheit to Celsius or Celsius to Fahrenheit. Create a menu based application with 3 options, Convert Fahrenheit to Celsius, Convert Celsius to Fahrenheit, and Exit. You'll need a conditional loop and a sentinel value, (For Example: X to Exit). Look for opportunities in the design to implement one or more GLOBAL CONSTANTs.

Having trouble using a sentinel value in a while loop. 3 would be the value....but not sure how to go about it.

print( '1. Convert Fahranheit to Celcius')

print('2. Convert Celcius to Fahrenheit')

print('3. Exit')

while True:

task=input('Enter the number to perform the corresponding task:')

if task == '1': fahrenheit=float(input('Enter the temperature in fahrenheit:')) celsius = (fahrenheit-32)*5/9

print'%.2f Fahrenheit is: %0.2f Celsius' %(fahrenheit, celsius))

if task == '2': celsius = float(input("Enter temperature in celsius: ")) fahrenheit = (celsius * 9/5) + 32

print('%.2f Celsius is: %0.2f Fahrenhei' %(celsius, fahrenheit))


Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

import javautilScanner Main class public class Temperatures Global constants public static int F... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!