-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHomework3.java
More file actions
47 lines (43 loc) · 1.3 KB
/
Copy pathHomework3.java
File metadata and controls
47 lines (43 loc) · 1.3 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
package com.example.Homework3;
import java.util.Scanner;
public class Homework3 {
public static Scanner scanner = new Scanner(System.in);
public void smallest(int x, int y, int z){
if (x <= y){
if (x <= z){
System.out.println(x);
}
else if (x > z){
System.out.println(z);
}
}
if (x > y){
if (y <= z){
System.out.println(y);
}
else if (y > z){
System.out.println(z);
}
}
}
public void letter(char x, char y){
if (Math.abs(((int)x) - ((int)y)) <= 2 || Math.abs(Math.abs(((int)x) - ((int)y)) - 32) <= 2){
System.out.println("True");
}
else{
System.out.println("False");
}
}
public static void main(String[]args){
Homework3 runner = new Homework3();
System.out.println("Input 3 integers");
int a = scanner.nextInt();
int b = scanner.nextInt();
int c = scanner.nextInt();
System.out.println("Input 2 chars");
char d = scanner.next().charAt(0);
char e = scanner.next().charAt(0);
runner.smallest(a, b, c);
runner.letter(d, e);
}
}