From bd480f274872d9f7d7a2441313d5620b00a7e09c Mon Sep 17 00:00:00 2001 From: zan Date: Mon, 27 Nov 2017 10:04:02 -0500 Subject: [PATCH] notdone --- src/main/java/io/zipcoder/Problem1.java | 46 +++++++++++++++++++++ src/test/java/io/zipcoder/Problem1Test.java | 17 ++++++++ 2 files changed, 63 insertions(+) diff --git a/src/main/java/io/zipcoder/Problem1.java b/src/main/java/io/zipcoder/Problem1.java index 6cd6024..7a311a3 100644 --- a/src/main/java/io/zipcoder/Problem1.java +++ b/src/main/java/io/zipcoder/Problem1.java @@ -1,4 +1,50 @@ package io.zipcoder; +import java.util.*; + public class Problem1 { + + public static void main(String[] args) { + String input = "The Farmer went to the store to get 1 dollar’s worth of fertilizer"; + String keyReplacers = "‘f’ : ‘7’, ‘s’:’$’, ‘1’:’!’, ‘a’.:’@’"; + String result = ""; + + + + + } + + public void createHashMap(){ + String input = "The Farmer went to the store to get 1 dollar’s worth of fertilizer"; + String keyReplacers = "‘f’ : ‘7’, ‘s’:’$’, ‘1’:’!’, ‘a’.:’@’"; + String result = ""; + HashMap values = new HashMap(); + //values.put(input,result); +// for (Map.Entry entry : values.entrySet()) { +// input = input.replace(input + entry.getKey() + result, entry.getValue()); +// result = input; +// } +// System.out.println(result); + values.put("f","7"); + values.put("s","$"); + values.put("1","!"); + values.put("a","@"); + for (Map.Entry valueReplacer : values.entrySet()) { + result = input.replace("f" + "s","7"+"$" ); + + } + + } + + + + + + + + //I know I am not there yet. I had a general idea. With more time I would have gotten it. I was going to use the map to replace + //hasNext + + + } diff --git a/src/test/java/io/zipcoder/Problem1Test.java b/src/test/java/io/zipcoder/Problem1Test.java index de82e99..d818f09 100644 --- a/src/test/java/io/zipcoder/Problem1Test.java +++ b/src/test/java/io/zipcoder/Problem1Test.java @@ -1,4 +1,21 @@ package io.zipcoder; +import org.junit.*; public class Problem1Test { + + @Test + public void mainTest(){ + String input = "The Farmer went to the store to get 1 dollar’s worth of fertilizer"; + + String expected = "The 7@rmer went to the $tore to get ! doll@r’$ worth of 7ertilizer"; + + String actual = ""; + + Assert.assertEquals(expected,actual); + + } + + + + }