From 04eff3a839a8f451931285477e8b8c50c23f6860 Mon Sep 17 00:00:00 2001 From: jcheong641 Date: Sat, 27 Jan 2024 23:16:39 -0800 Subject: [PATCH] Completed Java Lab 002 --- .idea/misc.xml | 2 +- README.md | 1 + src/Date.java | 24 ++++++++++++++++++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 src/Date.java diff --git a/.idea/misc.xml b/.idea/misc.xml index cf9abe6..cbbff6a 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..d2b7b25 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,7 @@ 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.** + In my modified code, I implemented 5 errors which were meant to stump my classmates. The first error that I made was capitalizing the word "static" in the code. The next error was making "System.in.println" instead of "System.out.println". For one line, I made two errors by identifying y as a double even though the number was a regular whole number, and I also did not end the line with a semicolon. Last, I did not capitalize "system" at the end of the code. I posted my code in the student lounge discussion in hopes of some replies, but did not receive any at this point. When analyzing my code, I would look at the basics like capitalization and punctuation to make sure they are accurate. Then, if I cannot identify anymore errors, I would run the code and see what else needs to be fixed. I completed a classmate's code and was able to identify all 5 errors. --- ## Part 2: Date Display Program diff --git a/src/Date.java b/src/Date.java new file mode 100644 index 0000000..3b9c06f --- /dev/null +++ b/src/Date.java @@ -0,0 +1,24 @@ +public class Date { + // Initially working program. + public static void main(String[] args) { + String day, date, month, year; + + day = "Friday"; + date = "27"; + month = "January"; + year = "2024"; + + System.out.println("Date.java"); + System.out.println("Day: " + day); + System.out.println("Date: " + date); + System.out.println("Month: " + month); + System.out.println("Year: " + year); + + System.out.println("American Format:"); + System.out.println(day + ", " + month + " " + date + ", " + year); + + System.out.println("European Format:"); + System.out.println(date + " " + month + " " + year); + + } +}