From 81c9565880f4ff7163618ebb826b81bf2515d61f Mon Sep 17 00:00:00 2001 From: Christopher Bohn <bohn@unl.edu> Date: Sun, 10 Nov 2024 10:40:40 -0600 Subject: [PATCH] starter code for homework 7 --- loops-and-collections/.gitignore | 62 +++++++++++++++++++ loops-and-collections/pom.xml | 38 ++++++++++++ .../unl/cse/soft160/loops/Observation.java | 21 +++++++ .../soft160/loops/TemperatureAnalysis.java | 32 ++++++++++ .../java/edu/unl/cse/soft160/loops/.gitkeep | 0 5 files changed, 153 insertions(+) create mode 100644 loops-and-collections/.gitignore create mode 100644 loops-and-collections/pom.xml create mode 100644 loops-and-collections/src/main/java/edu/unl/cse/soft160/loops/Observation.java create mode 100644 loops-and-collections/src/main/java/edu/unl/cse/soft160/loops/TemperatureAnalysis.java create mode 100644 loops-and-collections/src/test/java/edu/unl/cse/soft160/loops/.gitkeep diff --git a/loops-and-collections/.gitignore b/loops-and-collections/.gitignore new file mode 100644 index 0000000..f35f60a --- /dev/null +++ b/loops-and-collections/.gitignore @@ -0,0 +1,62 @@ +# Mac file finder metadata +.DS_Store +# Windows file metadata +._* +# Thumbnail image caches +Thumbs.db +ethumbs.db +# MS Office temporary file +~* +# Emacs backup file +*~ + +# Common +[Bb]in/ +[Bb]uild/ +[Oo]bj/ +[Oo]ut/ +[Tt]mp/ +[Xx]86/ +[Ii][Aa]32/ +[Xx]64/ +[Xx]86_64/ +[Xx]86-64/ +[Aa]rm +[Aa]32 +[Tt]32 +[Aa]64 +*.tmp +*.bak +*.bk +*.swp + +# Java files +*.class +javadoc/ + +# Maven +target/ +pom.xml.tag +pom.xml.releaseBackup +pom.xml.versionsBackup +pom.xml.next +release.properties +dependency-reduced-pom.xml +buildNumber.properties +.mvn/timing.properties + +# JetBrains (IntelliJ IDEA, PyCharm, etc) files +.idea/ +cmake-build-*/ +*.iml +*.iws +*.ipr + +# Eclipse files +.settings/ +.project +.classpath +.buildpath +.loadpath +.factorypath +local.properties diff --git a/loops-and-collections/pom.xml b/loops-and-collections/pom.xml new file mode 100644 index 0000000..fac59a5 --- /dev/null +++ b/loops-and-collections/pom.xml @@ -0,0 +1,38 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <groupId>edu.unl.cse.soft160.loops</groupId> + <artifactId>loops_and_collections</artifactId> + <version>1.0-SNAPSHOT</version> + <packaging>jar</packaging> + + <name>loops_and_collections</name> + <url>http://maven.apache.org</url> + + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + </properties> + + <build> + <plugins> + <plugin> + <artifactId>maven-compiler-plugin</artifactId> + <version>3.8.1</version> + <configuration> + <source>11</source> + <target>11</target> + </configuration> + </plugin> + </plugins> + </build> + + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.13</version> + <scope>test</scope> + </dependency> + </dependencies> +</project> diff --git a/loops-and-collections/src/main/java/edu/unl/cse/soft160/loops/Observation.java b/loops-and-collections/src/main/java/edu/unl/cse/soft160/loops/Observation.java new file mode 100644 index 0000000..16bf0a4 --- /dev/null +++ b/loops-and-collections/src/main/java/edu/unl/cse/soft160/loops/Observation.java @@ -0,0 +1,21 @@ +package edu.unl.cse.soft160.loops; + +import java.time.LocalDate; + +public class Observation { + private Double measurement; + private LocalDate date; + + public Observation(Double measurement, LocalDate date) { + this.measurement = measurement; + this.date = date; + } + + public Double getMeasurement() { + return measurement; + } + + public LocalDate getDate() { + return date; + } +} diff --git a/loops-and-collections/src/main/java/edu/unl/cse/soft160/loops/TemperatureAnalysis.java b/loops-and-collections/src/main/java/edu/unl/cse/soft160/loops/TemperatureAnalysis.java new file mode 100644 index 0000000..613174b --- /dev/null +++ b/loops-and-collections/src/main/java/edu/unl/cse/soft160/loops/TemperatureAnalysis.java @@ -0,0 +1,32 @@ +package edu.unl.cse.soft160.loops; + +import java.util.ArrayList; +import java.util.List; +import java.time.LocalDate; + +public class TemperatureAnalysis { + /* TASK 1 */ + + public static LocalDate getDateForLowestTemperature(List<Observation> observations) { + return null; + } + + /* TASK 2 */ + + public static Double getLowestTemperatureBetweenTwoDates(List<Observation> observations, + LocalDate date1, LocalDate date2) { + return null; + } + + /* TASK 3 */ + + public static List<Double> getExtremeTemperatures(List<Observation> observations) { + return new ArrayList<Double>(); + } + + /* TASK 4 */ + + public static Double getMostRecentExtremeTemperature(List<Observation> observations) { + return null; + } +} diff --git a/loops-and-collections/src/test/java/edu/unl/cse/soft160/loops/.gitkeep b/loops-and-collections/src/test/java/edu/unl/cse/soft160/loops/.gitkeep new file mode 100644 index 0000000..e69de29 -- GitLab