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/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/README.md b/README.md index 40c2bd8..f557921 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,12 @@ Review the flow of execution through the program [Zippo.java](src/Zippo.java), a 1. Write the number 1 next to the first line of code in this program that will execute. 2. Write the number 2 next to the second line of code, and so on until the end of the program. 3. What is the value of the parameter `blimp` when `baffle` gets invoked? +`baffle` gets invoked at line 11, so `blimp` is unassigned. 4. What is the output of this program? +ik +rattle +ping zoop +boo-wa-ha-ha --- @@ -43,7 +48,9 @@ Answer questions about stack diagrams and program output without running the pro 2. What is the output by the following program? * Paste your output in the bash code-block below. ```bash - +No, I wug. +You wugga wug. +I wug. ``` --- @@ -55,7 +62,9 @@ Explore method invocations and their consequences. **Questions to answer in the README.md via Markdown:** 1. What happens if you invoke a value method and don’t do anything with the result; that is, if you don’t assign it to a variable or use it as part of a larger expression? +The method doesn't do anything and is ignored. 2. What happens if you use a void method as part of an expression? For example, try `System.out.println("boo!") + 7;`. +When you run the program you get an error that says "not a statement", intelliJ tells you that '+' cannot be applied to 'void' --- @@ -71,7 +80,10 @@ Draw a stack diagram that shows the state of the program the second time `zoop` 2. What is the complete output? * Paste your output in the bash code-block below. ```bash - +just for +any not more +It's breakfast +! ``` ## Submission diff --git a/Screenshot01.png b/Screenshot01.png new file mode 100644 index 0000000..a3a1855 Binary files /dev/null and b/Screenshot01.png differ diff --git a/Screenshot02.png b/Screenshot02.png new file mode 100644 index 0000000..f2f919b Binary files /dev/null and b/Screenshot02.png differ diff --git a/src/RedesignDate.java b/src/RedesignDate.java new file mode 100644 index 0000000..e2f98d4 --- /dev/null +++ b/src/RedesignDate.java @@ -0,0 +1,22 @@ +public class RedesignDate { + + static String day = "Tuesday"; + static String month = "February"; + static int date = 6; + static int year = 2024; + + public static void main(String[] args) { + printAmerican(); + printEuropean(); + } + + public static void printAmerican() { + System.out.printf("The date in American Format is %s, %s %02d, %d", day, month, date, year); + System.out.println(); + } + + public static void printEuropean() { + System.out.printf("The date in European Format is %s, %d, %s %02d", day, year, month, date); + System.out.println(); + } +} diff --git a/src/Zippo.java b/src/Zippo.java index 04581a4..5c523a1 100644 --- a/src/Zippo.java +++ b/src/Zippo.java @@ -13,7 +13,7 @@ public static void zippo(String quince, int flag) { } } - public static void main(String[] args) { - zippo("rattle", 13); + /*1*/ public static void main(String[] args) { + /*2*/ zippo("rattle", 13); } }