Sunday, June 30, 2019

Menu Driven Temperature Program in Python


Write a menu-driven program that uses a function to convert the following temperatures Fahrenheit to Celsius & Kelvin, Celsius to Fahrenheit & Kelvin and Kelvin to Fahrenheit & Celsius. The program also has an exit program option in order for the user to quit the program.

If you like my work please click the ads on my website to support my work. I will really appreciate your help. 

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me in the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.
My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod I also accepting computer repair, networking and Arduino Project development at a very affordable price.

My personal website is http://www.jakerpomperada.com


Program Listing

# temperature.py
# Rollyn M. Moises and Jake R. Pomperada
# February 28, 2019    Thursday
# Bacolod City, Negros Occidental


def fah():
    print();
    F=int(input('\tEnter the temperature on Fahrenheit(F) : '));
    C=(F - 32) * 5/9;
    K=(F - 32) * 5/9 + 273.15;
    print();
    print("\tFahrenheit Value :",round(F,2));
    print("\tCelsius Value :",round(C,2));
    print("\tKelvin Value:",round(K,2));
    print();
    print("\tEND OF PROGRAM");

def cel():
    print();
    C=int(input('\tEnter the temperature on Celsius(C) : '));
    F=(C * 9/5) + 32;
    K=C + 273.15;
    print();
    print("\tFahrenheit Value :",round(F,2));
    print("\tCelsius Value :",round(C,2));
    print("\tKelvin Value:",round(K,2));
    print();
    print("\tEND OF PROGRAM");

def kel():
    print();
    K=int(input('\tEnter the temperature on Kelvin(K) : '));
    F=(K - 273.15) * 9/5 + 32;
    C=K - 273.15;
    print();
    print("\tFahrenheit Value :",round(F,2));
    print("\tCelsius Value :",round(C,2));
    print("\tKelvin Value:",round(K,2));
    print();
    print("\tEND OF PROGRAM");

print();
print("\t===== MAIN MENU =====");
print();
print("[1] Fahrenheit to Celsius & Kelvin");
print("[2] Celsius to Fahrenheit & Kelvin");
print("[3] Kelvin to Fahrenheit & Celsius");
print("[4] Exit Program");
print();
n=int(input('\tEnter the choice: '));
if n==1:
      fah()
elif n==2:
      cel()
elif n==3:
      kel()
elif n==4:
      exit()
else:
      print('Invalid options')


No comments:

Post a Comment