ComeçarComece de graça

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.

Este exercício faz parte do curso

Importing Data in Java

Ver curso

Instruções do exercício

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

Exercício interativo prático

Experimente este exercício completando este código de exemplo.

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);
    }
}
Editar e executar o código