diff --git a/.idea/misc.xml b/.idea/misc.xml index cf9abe6..501ce09 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/README.md b/README.md index 931badb..a480f80 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,13 @@ HINT: CR Computer Science Discord groups are a great way to play this game remot **After 5 rounds, modify this README.md with a paragraph describing your attempt to stump your partner and the steps your partner took to identify and correct the error or the steps you think they should have used if they didn't solve the problem.** +## Possible errors to add include: +- Typos +- Not defining a variable as static +- Using unclosed curly braces or parentheses. +- Using the wrong character where a parenthesis should be +- Some less likely, but more unique ways could be to replace semicolons with greek question marks, or editing data which is interpreted in specific ways such that it no longer runs without runtime errors. (i.e removing an s from a format string) + --- ## Part 2: Date Display Program diff --git a/src/StumpTheChump.java b/src/StumpTheChump.java index dffc096..5503873 100644 --- a/src/StumpTheChump.java +++ b/src/StumpTheChump.java @@ -1,6 +1,31 @@ public class StumpTheChump { // Initially working program. + static String date = ""; + static int day = 24; + static int month = 1; + static int year = 2024; + + public static String decrypt(String s, int r) + { + for(int i = r; i >= 0; i--) + { + s = s.replace("%s%s", "%"); + if(i%2 ==0) + { + s = s.replace("s%", "%s"); + } + } + return s; + } + public static void main(String[] args) { - System.out.println("Hi Chump, can you be stumped?"); + System.out.println("Day: " + day); + System.out.println("Month: " + month); + System.out.println("Year: " + year); + + date = month+"/"+day+"/"+year; + System.out.printf("\nCurrent Date (American): " + decrypt("sss%s%ss%s%sss%s%ss%s%ssss%s%ss%s%sss%s%ss%s%sssss%s%ss%s%sss%s%ss%s%ssss%s%ss%s%sss%s%ss%s%sss/sss%s%ss%s%sss%s%ss%s%ssss%s%ss%s%sss%s%ss%s%sssss%s%ss%s%sss%s%ss%s%ssss%s%ss%s%sss%s%ss%s%sss/sss%s%ss%s%sss%s%ss%s%ssss%s%ss%s%sss%s%ss%s%sssss%s%ss%s%sss%s%ss%s%ssss%s%ss%s%sss%s%ss%s%sss" + "\n", 4), month, day, year); + date = day+"/"+month+"/"+year; + System.out.printf("\nCurrent Date (European): " + decrypt("sss%s%ss%s%sss%s%ss%s%ssss%s%ss%s%sss%s%ss%s%sssss%s%ss%s%sss%s%ss%s%ssss%s%ss%s%sss%s%ss%s%sss/sss%s%ss%s%sss%s%ss%s%ssss%s%ss%s%sss%s%ss%s%sssss%s%ss%s%sss%s%ss%s%ssss%s%ss%s%sss%s%ss%s%sss/sss%s%ss%s%sss%s%ss%s%ssss%s%ss%s%sss%s%ss%s%sssss%s%ss%s%sss%s%ss%s%ssss%s%ss%s%sss%s%ss%s%sss" + "\n", 4), day, month, year); } }