From d651c17992ec2e3e082682c7d64e9ecd12d57b2d Mon Sep 17 00:00:00 2001 From: Avansumm Date: Wed, 24 Jan 2024 12:52:27 -0800 Subject: [PATCH 1/3] added calandar code --- .idea/misc.xml | 2 +- src/StumpTheChump.java | 39 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 39 insertions(+), 2 deletions(-) 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/src/StumpTheChump.java b/src/StumpTheChump.java index dffc096..bb663d4 100644 --- a/src/StumpTheChump.java +++ b/src/StumpTheChump.java @@ -1,6 +1,43 @@ public class StumpTheChump { // Initially working program. + static String date = ""; + static int day = 24; + static int month = 1; + static int year = 2024; + + public static String encrypt(String s, int r) + { + for (int i = 0; i <= r; i++) + { + if(i%2 == 0){ + s = s.replace("%s", "s%"); + } + s = s.replace("%", "%s%s"); + } + return s; + } + + 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); } } From 20aae6186e1abe41434758fc3aecfd55be09f853 Mon Sep 17 00:00:00 2001 From: Avansumm Date: Wed, 24 Jan 2024 12:53:07 -0800 Subject: [PATCH 2/3] removed some stuff lol --- src/StumpTheChump.java | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/src/StumpTheChump.java b/src/StumpTheChump.java index bb663d4..5503873 100644 --- a/src/StumpTheChump.java +++ b/src/StumpTheChump.java @@ -5,18 +5,6 @@ public class StumpTheChump { static int month = 1; static int year = 2024; - public static String encrypt(String s, int r) - { - for (int i = 0; i <= r; i++) - { - if(i%2 == 0){ - s = s.replace("%s", "s%"); - } - s = s.replace("%", "%s%s"); - } - return s; - } - public static String decrypt(String s, int r) { for(int i = r; i >= 0; i--) From 86ea7ffe0ca25660df5c228f19258ce1677c2921 Mon Sep 17 00:00:00 2001 From: Caleb Brown Date: Wed, 24 Jan 2024 17:27:19 -0800 Subject: [PATCH 3/3] Added information to part 1 --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) 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