/* The source of the river Suså is in Gøgsmose. * Suså has Kongskilde Bæk, Sorø Å and Ringsted Å as tributaries. * The source of Kongskilde Bæk is in Kongskilden. * The source of Sorø Å is in Sorø Sø. * The source of Ringsted Å is in Gyrstinge Sø. * Ringsted Å has Vigerdalså as its sole tributary, * whose source, in turn, is Valsølille Sø. * We will assign arbitrary length to rives, * and arbitrary liters per hour to sources */ class WaterWayTest { public static void main(String[] args){ WaterWay suså = new WaterWay("Suså", 65.4 , new WaterSource("Gøgsmose", 1200) ); WaterWay kkbæk = new WaterWay("Kongskilde bæk", 5.3 , new WaterSource("Kongskilde", 680) ); WaterWay sorøå = new WaterWay("Sorø å", 18.3 , new WaterSource("Sorø sø", 2100) ); WaterWay ringå = new WaterWay("Ringsted å", 22.6 , new WaterSource("Gyrstinge Sø", 3500) ); WaterWay vigerdalså = new WaterWay("Vigerdalså", 7.8 , new WaterSource("Valsølille sø", 350) ); suså.addTributary(kkbæk); suså.addTributary(sorøå); suså.addTributary(ringå); ringå.addTributary(vigerdalså); System.out.println("Total length of suså riversystem is: " + suså.totalLength() + " km."); // 119.4 System.out.println("Total water flow of suså riversystem is: " + WaterWay.totalLitersPrHour(suså) + " l/h"); // 7830 } }