6. Libraries, Packages, and Modules
Activity 1: Tracking Summer High Temperatures
Solution
- Create an IntelliJ Gradle project. Modify
settings.gradle
as follows:rootProject.name = 'temps'
- Modify
build.gradle
as follows:build.gradle
1Â Â buildscript { 2Â Â Â Â Â Â repositories { 3Â Â Â Â Â Â Â Â Â Â jcenter() 4Â Â Â Â Â Â } 5Â Â Â Â Â Â dependencies { 6Â Â Â Â Â Â Â Â Â Â classpath 'com.github.jengelman.gradle.plugins:shadow:2.0.1' 7Â Â Â Â Â Â } 8Â Â }
- Create a
class
namedCity
. Add the following fields and constructor:package com.packtpub.temps; public class City { Â Â Â Â private String name; Â Â Â Â private String country; Â Â Â Â double summertimeHigh;Â Â Â Â Â ...