Skip to content

Commit 662ad5d

Browse files
committed
case cwiczenia
1 parent bd5bfcb commit 662ad5d

File tree

9 files changed

+229
-36
lines changed

9 files changed

+229
-36
lines changed

.idea/workspace.xml

Lines changed: 107 additions & 36 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
1.66 KB
Binary file not shown.
805 Bytes
Binary file not shown.
1.09 KB
Binary file not shown.
610 Bytes
Binary file not shown.

src/jp/Calculator.java

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
package jp;
2+
3+
import java.util.Scanner;
4+
5+
public class Calculator {
6+
public static void main(String[] args) {
7+
8+
Scanner scanner = new Scanner(System.in);
9+
System.out.println("dozwolone operacje (+)(-)(*)(/)(%)(^)");
10+
double var1 = scanner.nextDouble();
11+
scanner.nextLine();
12+
char key = scanner.nextLine().charAt(0);
13+
double var2 = scanner.nextDouble();
14+
15+
switch(key){
16+
case '+':
17+
System.out.printf("%f %c %f = %.2f",var1,key,var2,var1 + var2);
18+
break;
19+
case '-':
20+
System.out.printf("%f %c %f = %.2f",var1,key,var2,var1 - var2);
21+
break;
22+
case '*':
23+
System.out.printf("%f %c %f = %.2f",var1,key,var2,var1 * var2);
24+
break;
25+
case '/':
26+
System.out.printf("%f %c %f = %.2f",var1,key,var2,var1 / var2);
27+
break;
28+
case '%':
29+
System.out.printf("%f %c %f = %.2f",var1,key,var2,var1 % var2);
30+
break;
31+
case '^':
32+
System.out.printf("%f %c %f = %.2f",var1,key,var2,Math.pow(var1 , var2));
33+
break;
34+
}
35+
scanner.close();
36+
37+
38+
39+
40+
}}
41+
42+

src/jp/JP10.java

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package jp;
2+
3+
public class JP10 {
4+
public static void main(String[] args) {
5+
6+
int decimalNum = 5;
7+
switch(decimalNum){
8+
case 0:
9+
System.out.println(0);
10+
break;
11+
case 1:
12+
System.out.println("I");
13+
break;
14+
case 2:
15+
System.out.println("II");
16+
break;
17+
case 3:
18+
System.out.println("III");
19+
break;
20+
case 4:
21+
System.out.println("IV");
22+
break;
23+
case 5:
24+
System.out.println("V");
25+
break;
26+
default:
27+
System.out.println("Nie ma takiej liczby");
28+
29+
}
30+
31+
32+
33+
}
34+
}

src/jp/JP8.java

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package jp;
2+
3+
import java.util.Scanner;
4+
5+
public class JP8 {
6+
public static void main(String[] args) {
7+
Scanner scanner = new Scanner(System.in);
8+
9+
System.out.println("Podaj staż pracy :\n (1) Junior 0-5 lat \n (2) Regular 5-10 lat \n (3) Senior wiecej niz 10 lat \n (0) Wyjście");
10+
int empl_fell = scanner.nextInt();
11+
if(empl_fell >= 0 && empl_fell < 5){
12+
System.out.println("Junior");
13+
}else if(empl_fell >= 5 && empl_fell < 10){
14+
System.out.println("Regular");
15+
} else {
16+
System.out.println("Senior");
17+
}
18+
switch (empl_fell){
19+
case 0: case 1: case 2: case 3: case 4:
20+
System.out.println("Junior");
21+
break;
22+
case 5: case 6: case 7: case 8: case 9:
23+
System.out.println("Regular");
24+
break;
25+
default:
26+
System.out.println("Senior");
27+
}
28+
scanner.close();
29+
}
30+
31+
}

0 commit comments

Comments
 (0)