diff --git a/lesson_07/conditionals/src/lesson7.ts b/lesson_07/conditionals/src/lesson7.ts deleted file mode 100644 index 52f45df8b..000000000 --- a/lesson_07/conditionals/src/lesson7.ts +++ /dev/null @@ -1,102 +0,0 @@ -import { computeLexicographicDistance } from "./util.js"; - -/** - * Returns true if the provided age meets the minimum US voting age and false otherwise. - * - * @param age The age to check. - * @return True if the age corresponds to a voting age and false otherwise. - */ -export function canVote(age: number): boolean { - return false; -} - -/** - * Compares two strings lexicographically. - * - * @param a The first `string` to compare. - * @param b The second `string` to compare. - * @return -1 if a is less than b, 1 if a is greater than b, and 0 otherwise. - */ -export function compareStrings(a: string, b: string): number { - // The distance will be a number less than 0 if string `a` is lexicographically less than `b`, 1 - // if it is greater, and 0 if the strings are equal. - const distance = computeLexicographicDistance(a, b); - - // TODO(you): Finish this method. - - return 0; -} - -/** - * Converts a GPA on the 4.0 scale to the corresponding letter grade using the college board - * scale. See - * https://bigfuture.collegeboard.org/plan-for-college/college-basics/how-to-convert-gpa-4.0-scale - * for details. - * - * @param gpa The GPA value. - * @return The letter grade ("A+", "A", "A-", "B+", etc.). - */ -export function convertGpaToLetterGrade(gpa: number): string { - return "F"; -} - -/** - * Computes the factorial of the given value of `n`. - * - * @param n The value for which to compute the factorial. - * @return The factorial of n. - */ -export function computeFactorial(n: number): number { - return 0; -} - -/** - * Adds all of the provided values and returns the sum. - * - * @param values The values to sum. - * @return The sum of all the values. - */ -export function addNumbers(values: number[]): number { - return 0; -} - -/** - * Returns an array of the first `n` Fibonacci numbers starting from 1. - * - * @param n The first `n` of Fibonacci values to compute. - * @return An array containing the first `n` Fibonacci values. - */ -export function getFirstNFibonacciNumbers(n: number): number[] { - return []; -} - -/** - * Finds a value in an array of values. - * - * @param values The values to search. - * @param start The left most index to search. - * @param end The right most index to search. - * @param value The value to look for. - * @return The index of the value if found in the array and -1 otherwise. - */ -export function binarySearch( - values: number[], - start: number, - end: number, - value: number, -): number { - if (end < start) { - // The range is not valid so just return -1. - return -1; - } - - const pivotIndex = Math.floor((start + end) / 2); // The index in the middle of the array. - - // TODO(you): Finish implementing this algorithm - - // If values[pivotIndex] is equal to value then return `pivotIndex`. - // Else if values[pivotIndex] is greater than the value, then - // call `binarySearch(values, start, pivotIndex - 1, value)` and return its value; - // Else call `binarySearch(values, pivotIndex + 1, end, value)` and return its value. - return -1; -} diff --git a/lesson_09/types/types_app/src/main/java/com/codedifferently/lesson9/dataprovider/NileJackProvider2.java b/lesson_09/types/types_app/src/main/java/com/codedifferently/lesson9/dataprovider/NileJackProvider2.java new file mode 100644 index 000000000..c91568630 --- /dev/null +++ b/lesson_09/types/types_app/src/main/java/com/codedifferently/lesson9/dataprovider/NileJackProvider2.java @@ -0,0 +1,25 @@ +package com.codedifferently.lesson9.dataprovider; + +import java.util.Map; +import org.springframework.stereotype.Service; + +@Service +public class NileJackProvider2 extends DataProvider { + @Override + public String getProviderName() { + return "nilejack"; + } + + @SuppressWarnings("rawtypes") + @Override + public Map getColumnTypeByName() { + return Map.of( + "column1", Double.class, + "column2", String.class, + "column3", Short.class, + "column4", Integer.class, + "column5", Boolean.class, + "column6", Float.class, + "column7", Long.class); + } +} diff --git a/lesson_09/types/types_app/src/main/resources/data/nilejack.json b/lesson_09/types/types_app/src/main/resources/data/nilejack.json new file mode 100644 index 000000000..13ba87d7c --- /dev/null +++ b/lesson_09/types/types_app/src/main/resources/data/nilejack.json @@ -0,0 +1,92 @@ +[ + { + "column1": "1.2155415868200682E308", + "column2": "ay7uqf59vgk", + "column3": "13631", + "column4": "392587112", + "column5": "true", + "column6": "2.8648133E38", + "column7": "6297398905888630784" + }, + { + "column1": "8.321620430752238E307", + "column2": "5yqhp07k6gc", + "column3": "12985", + "column4": "2138528365", + "column5": "true", + "column6": "3.083706E37", + "column7": "2616303035857536512" + }, + { + "column1": "7.314389284316176E307", + "column2": "in3qm8o5f7c2", + "column3": "30361", + "column4": "1874275284", + "column5": "false", + "column6": "2.7549848E38", + "column7": "8536738639975246848" + }, + { + "column1": "4.590854083968467E307", + "column2": "453gqy02cns", + "column3": "16147", + "column4": "1478502328", + "column5": "false", + "column6": "1.2205455E38", + "column7": "4986821522086977536" + }, + { + "column1": "5.539101999945017E307", + "column2": "af9yj1mi", + "column3": "1563", + "column4": "1121270896", + "column5": "false", + "column6": "1.7991684E38", + "column7": "8464433726762726400" + }, + { + "column1": "1.7336734246153826E308", + "column2": "ewunyjfxqd4", + "column3": "23145", + "column4": "1044014594", + "column5": "false", + "column6": "2.532904E37", + "column7": "6806636668204898304" + }, + { + "column1": "1.7645926782579685E308", + "column2": "2xf6pw3ql4", + "column3": "19516", + "column4": "400596822", + "column5": "false", + "column6": "2.32627E38", + "column7": "2038097960985824512" + }, + { + "column1": "3.9156902272053513E307", + "column2": "iygew2qvtou", + "column3": "7088", + "column4": "362362593", + "column5": "true", + "column6": "3.2023805E38", + "column7": "5273750678048173056" + }, + { + "column1": "1.2284458016333363E308", + "column2": "py3o84c6kqf", + "column3": "27005", + "column4": "1810294689", + "column5": "false", + "column6": "1.5230078E38", + "column7": "8212126872880282624" + }, + { + "column1": "1.439695246182645E308", + "column2": "x7d8ibz09re1", + "column3": "22486", + "column4": "520410192", + "column5": "true", + "column6": "1.0172832E38", + "column7": "4673806278628105216" + } +] \ No newline at end of file