Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
27 changes: 26 additions & 1 deletion src/StumpTheChump.java
Original file line number Diff line number Diff line change
@@ -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);
}
}