package com.google.sps.agents;

// Imports the Google Cloud client library
import com.google.protobuf.Value;
import com.google.sps.utils.LocationUtils;
import java.util.Map;

/** Weather Agent */
public class Weather implements Agent {
  private final String intentName;
  private String displayAddress;
  private String searchAddress;
  private String output = null;

  public Weather(String intentName, Map<String, Value> parameters) {
    this.intentName = intentName;
    try {
      setParameters(parameters);
    } catch (Exception e) {
      return;
    }
  }

  @Override
  public void setParameters(Map<String, Value> parameters) {
    this.displayAddress = LocationUtils.getDisplayAddress("address", parameters);
    this.searchAddress = LocationUtils.getFormattedAddress("address", parameters);
    if (!displayAddress.isEmpty() && !searchAddress.isEmpty()) {
      String baseURL = "http://www.google.com/search?q=weather+in+";
      String[] individualWords = searchAddress.split(" ");
      String endURL = String.join("+", individualWords);
      this.redirect = baseURL + endURL;
      this.output = "Redirecting you to the current forecast in " + displayAddress + ".";
    }
  }

  @Override
  public String getOutput() {
    return this.output;
  }

  @Override
  public String getDisplay() {
    return null;
  }

  @Override
  public String getRedirect() {
    return null;
  }
}

@@ -360,16 +360,50 @@
  = null;
+%0A  private String redirect = null;
 %0A%0A  publ
@@ -1411,24 +1411,33 @@
 %0A    return 
-null
+this.redirect
 ;%0A  %7D%0A%7D%0A

Add missing redirect link