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/My program with errors.png b/My program with errors.png new file mode 100644 index 0000000..84e6c62 Binary files /dev/null and b/My program with errors.png differ diff --git a/Partner's program with errors.png b/Partner's program with errors.png new file mode 100644 index 0000000..40498c9 Binary files /dev/null and b/Partner's program with errors.png differ diff --git a/README.md b/README.md index 931badb..1c3cf82 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,16 @@ 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.** +**Reflection:** +* I attempted to stump my partner by including a few simple bugs. Most of the bugs were taking advantage of the case-sensitive nature of declaration and assignment statements. I also purposefully included some incorrect punctuation.I made sure the punctuation was similar to the correct style so as not to stand out too much. I also left out the last closing curly bracket to see if that would be noticed. Unfortunately, at the time of this submission my partner has not yet attempted to identify my bugs. I would recommend that they go line by line to look for punctuation and capitalization errors as well as paying attention to the type of variables that are declared and the format of the values assigned. +* The errors I found in my partner's code are as follows: + 1. Static should not be capitalized. + 2. The "minute" variable assignment should end with " ; ". + 3. System should be capitalized. + 4. There should be a space at the end of the string "the current time is". + 5. The statement printing "hour" is printing a string containing the characters "hour". To return the value of the hour variable no quotations should be used. + + --- ## Part 2: Date Display Program diff --git a/src/Date.java b/src/Date.java new file mode 100644 index 0000000..e7a1e8f --- /dev/null +++ b/src/Date.java @@ -0,0 +1,29 @@ +public class Date { + public static void main(String[] args) { + + String day; + String month; + int date; + int year; + //Define variables + + day = "Saturday"; + month = "January"; + date = 27; + year = 2024; + // Assign values to represent today's date. + + System.out.println(day); + System.out.println(month); + System.out.println(date); + System.out.println(year); + //Display each variable's value on separate lines for initial verification. + + //Compile and run + + System.out.printf("%s, %s %d, %d\n", day, month, date, year); + //Display the date in standard American format. + + System.out.printf("%s, %d %s %d", day, date, month, year); + } +} \ No newline at end of file diff --git a/src/StumpTheChump.java b/src/StumpTheChump.java index dffc096..2e72a02 100644 --- a/src/StumpTheChump.java +++ b/src/StumpTheChump.java @@ -1,6 +1,26 @@ +import java.util.Scanner; + public class StumpTheChump { // Initially working program. public static void main(String[] args) { System.out.println("Hi Chump, can you be stumped?"); + Scanner scanner = new Scanner(System.in); + + System.out.println("What is your name?"); + String name = scanner.nextLine(); + + System.out.print("Hi "); + System.out.print(name); + System.out.println(", what year were you born?"); + + int yearOfBirth = scanner.nextInt(); + int currentYear = 2024; + + System.out.print(name); + System.out.print(", you are "); + System.out.print(currentYear - yearOfBirth); + System.out.print(" years old!"); + } -} + +} \ No newline at end of file