-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathswitch6.java
More file actions
49 lines (45 loc) · 1.54 KB
/
switch6.java
File metadata and controls
49 lines (45 loc) · 1.54 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package swichcase;
import java.util.Scanner;
public class switch6 {
public static void main(String[] args) {
Scanner scanner=new Scanner(System.in);
double a,b;
System.out.println("1 : Detsimetr -> metr");
System.out.println("2 : Kilometr -> metr");
System.out.println("3 : Metr -> metr");
System.out.println("4 : Santimetr -> metr");
System.out.println("Choose: ");
int choose= scanner.nextInt();
switch (choose){
case 1->{
System.out.println("Detsimetr:");
a= scanner.nextDouble();
double natija=a/10;
System.out.printf("%.2f Desimetr = %.2f Metr",a,natija);
break;
}
case 2->{
System.out.println("Kilometr:");
a=scanner.nextDouble();
double natija=a/1000;
System.out.printf("Metr= %.2f",natija);
break;
}
case 3->{
System.out.println("Metrni kiriting:");
a= scanner.nextDouble();
double natija=a;
System.out.printf("Metr =%.2f",natija);
}
case 4->{
System.out.println("Santimetr:");
a= scanner.nextDouble();
double natija=a/100;
System.out.printf("%.2f Santimetr = %.2f Metr",a,natija);
}
default -> {
System.out.println("Noto`g`ri Variant");
}
}
}
}