-
Notifications
You must be signed in to change notification settings - Fork 0
/
Main.java
51 lines (41 loc) · 809 Bytes
/
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
package beginner.ex1016;
import java.util.Scanner;
public class Main
{
public static void main(String[] args)
{
UserInterface userInterface = new UserInterface();
userInterface.input();
userInterface.print();
}
}
class UserInterface
{
private Scanner input;
private Distance distance;
public UserInterface()
{
input = new Scanner(System.in);
distance = new Distance();
}
public void input()
{
distance.setKm(input.nextInt());
}
public void print()
{
System.out.println(distance.timeOfTravel() + " minutos");
}
}
class Distance
{
private int km;
public void setKm(int km)
{
this.km = km;
}
public int timeOfTravel()
{
return km * 2;
}
}