-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMain.java
58 lines (45 loc) · 1.09 KB
/
Main.java
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
50
51
52
53
54
55
56
57
58
package beginner.ex1013;
import java.util.Scanner;
public class Main
{
public static void main(String[] args)
{
TextInterface textInterface = new TextInterface();
textInterface.input();
textInterface.print();
}
}
class TextInterface
{
private Scanner input;
private HigherNumber higherNumber;
public TextInterface()
{
input = new Scanner(System.in);
higherNumber = new HigherNumber();
}
public void input()
{
higherNumber.setFetures(input.nextInt(), input.nextInt(), input.nextInt());
}
public void print()
{
System.out.printf("%d eh o maior%n", higherNumber.higherNumber());
}
}
class HigherNumber
{
private int n1, n2, n3;
public void setFetures(int n1, int n2, int n3)
{
this.n1 = n1;
this.n2 = n2;
this.n3 = n3;
}
public int higherNumber()
{
int firstComparison = (n1 + n2 + Math.abs(n1 - n2)) / 2;
int finalComparison = (firstComparison + n3 + Math.abs(firstComparison - n3)) / 2;
return finalComparison;
}
}