BaşlayınÜcretsiz Başlayın

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.

Bu egzersiz

Importing Data in Java

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

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

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

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);
    }
}
Kodu Düzenle ve Çalıştır