LoslegenKostenlos loslegen

Creating a table

A local weather station in New York needs to track daily temperature readings for a weekly report during an unusual heat wave. The station manager has asked you to create a simple data structure that can be used to generate statistics and visualizations for their weekly climate briefing. The table should help meteorologists identify trends and anomalies in temperature and precipitation patterns.

The Table, DoubleColumn, and StringColumn classes from Tablesaw have been imported for you.

Diese Übung ist Teil des Kurses

Importing Data in Java

Kurs anzeigen

Anleitung zur Übung

  • Create three columns: day of week, temperature, and precipitation.
  • Create a table and add all columns to it.

Interaktive Übung

Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.

public class WeatherTableExample {
    public static void main(String[] args) {
        // Create three columns
        StringColumn days = ____.____("Day", 
            "Monday", "Tuesday", "Wednesday");
            
        DoubleColumn temperatures = ____.create("Temperature", 
            22.5, 24.0, 23.2);
            
        DoubleColumn precipitation = ____.create("Precipitation", 
            0.0, 2.5, 5.2);
        
        // Create a table and add all columns
        Table weatherData = Table.____("WeatherData")
            .____(____, ____, precipitation);
        
        System.out.println(weatherData);
    }
}
Code bearbeiten und ausführen