Skip to content

Fatmah adel - Task3 : Tempreture Converter#9

Open
faimah57 wants to merge 2 commits intoProgramming-Club-IAU:mainfrom
faimah57:f@mh
Open

Fatmah adel - Task3 : Tempreture Converter#9
faimah57 wants to merge 2 commits intoProgramming-Club-IAU:mainfrom
faimah57:f@mh

Conversation

@faimah57
Copy link

@faimah57 faimah57 commented Mar 2, 2024

Code In java that convert between tempretures.
=========BRIFE ABOUT THE CODE========
The Program created to help the user wiht converting tempreture to the other tempreture by first started the program to show a menu
to let the user choice the wanted process.

  • If the user choice to convert to celsuis it will take the tempreture in fahrenhite, and it will be caluculated to find the result
    and show to the user.
  • If the user choice to convert to fahrenhite, it will take the tempreture in celsuis then caluclated to show the result to the user.
  • If the user choice to exit the program it will immediatly end the process, and show a thank message to the user.
    Other then these option, it will ask the user if it want to exit the program or he accedantlylet the cat walk on keybaord. If it yes
    then the same result as exit choice ,else it will be asking to write a correct choice and show the menu again.

=========THE CODE========
import java.util.Scanner; public class App { public static void main(String[] args){ Scanner input = new Scanner(System.in); System.out.println("===========Welcome To Temprture Converter Program==========="); int choice=0; double fah,cel; int answare; while (choice!=3){ System.out.print("Enter Your Choice\n1-Convert Celsius To Fahrenheit\n2-Convert Fahrenheit To Celsius\n3-Exit The Program\n>"); choice=input.nextInt(); if(choice==1){ System.out.print("Enter The Tempreture In Celsius: "); cel=input.nextDouble(); fah=cel*(9/5.0)+32.0; System.out.println("The Tempreture "+cel+" In Celsius Is Equalivent To "+fah+" In Fahrenheit"); System.out.println("======================================================="); } else if(choice==2){ System.out.print("Enter The Tempreture In Fahrenheit: "); fah=input.nextDouble(); cel=fah*(5/9.0)-32.0; System.out.println("The Tempreture "+fah+" In Fahrenheit Is Equalivent To "+cel+" In Celsius"); System.out.println("======================================================="); } else if(choice==3){ break; } else{ System.out.print("Are You Trying To Exit?\n1=Yes\t2=No\n>"); choice=input.nextInt(); if(choice==2){ System.out.print("Please Enter The Right Choice Again"); System.out.println("\n======================================================="); } if(choice==1) break; } } System.out.println("======================================================="); System.out.println(" Thank You For Using My Program\n\tPlease Rate Later\n"); } }
=========THE OUTPUTS ========
Screenshot 2024-03-02 130729

Screenshot 2024-03-02 130835

========= CODE FILES ========
README.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant