How do I fix these two codes that go together in Github based on the problems at the bottom? #4
J DebugFour4.java 1 X
J DebugTrip.java 1 X Welcome
Companion
..
J DebugFour4.java > DebugFour4 > main(String[])
4 import java.util.Scanner;
5 public class DebugFour4
6 Run | Debug
7 public static void main(String[] args)
8
9 Scanner input = new Scanner(System.in);
10 System.out.println("Enter destination city >> Chicago ");
11 String destinationCity = input.nextLine();
12 System.out.println("Enter destination city >> Seattle");
13 destinationCity = input.nextLine();
14 System.out.println("Enter mode of transportation >> Train ");
15 String destinationMode = input.nextLine();
16 DebugTrip trip1 = new DebugTrip(destinationCity);
17 DebugTrip trip2 = new DebugTrip(destinationCity, destinationCity);
18 DebugTrip trip3 = new DebugTrip(destinationCity, destinationCity, destinationCity);
19 display(trip1);
20 display(trip2);
21 display(trip3);
22
23
24
25
public static void display(DebugTrip trip)
26
27 System.out.println("Going to " + trip.getDestination());
28 System.out.println("Leaving from " + trip.getDepartureCity());
29 System.out.println("Going by " + trip.getMode());
30
J DebugTrip.java > DebugTrip > DebugTrip(String, String)
public class DebugTrip
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
private String destination;
private String departure;
private String mode;
private static final String DEFAULT_CITY = "Atlanta";
private static final String DEFAULT_MODE = "car";
public DebugTrip() {}; // Do not remove this line
public DebugTrip(String destination)
this(destination, DEFAULT_CITY, DEFAULT_MODE);
public DebugTrip(String destination, String departure)
this(destination);
this(departure);
public DebugTrip(String destination, String departure, String mode)
this.destination = destination;
this.departure = departure;
this.mode = mode;
public String getDestination()
return destination;
public String getDepartureCity()
return departure;
public String getMode()
return mode;
PROBLEMS 2 OUTPUT DEBUG CONSOLE TERMINAL PORTS1 V J DebugTrip.java Constructor call must be the first statement in a constructor Java1207959691 [Ln 23, Col 8] J DebugFour4.java Resource leak: 'input' is never closed Java536871799) [Ln 9, Col 15]
Filter (e.g. text, **/*.ts, !**/node_modules/**)
YOEXX