forked from Programming-Club-IAU/Task-1.3
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTask3.java
More file actions
35 lines (32 loc) · 1.18 KB
/
Task3.java
File metadata and controls
35 lines (32 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import java.util.Scanner;
public class Task3 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
Scanner Tem = new Scanner(System.in);
System.out.println("Temperture conversion app \n\n How can I help you? :) : \n -Type 1 to converting Celsius to Fahrenheit \n -Type 2 to converting Fahrenheit to Celsius \n -Type 3 to Exit the app");
while (true){
int num = input.nextInt();
if(num == 1){
System.out.println("Enter the temperture: ");
int tem = Tem.nextInt();
int result = (tem*9/5)+32;
System.out.println("Temperture in Fahrenheit is " + result);
System.out.println("Need somthing else?");
}
else if(num == 2){
System.out.println("Enter the temperture: ");
int tem = Tem.nextInt();
int result = (5 * (tem - 32)) / 9;
System.out.println("Temperture in Celsius is " + result);
System.out.println("Need somthing else?");
}
else if(num == 3){
System.out.println("Thank you for using the app \n Goodbye!");
break;
}
else{
System.out.println("Please choose a number form the list");
}
}
}
}