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..fbdfd22 100644 --- a/README.md +++ b/README.md @@ -27,8 +27,11 @@ 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? + +The value is when flag < 0 4. What is the output of this program? +![Screenshot_12.png](..%2F..%2FOneDrive%2FDocuments%2FLightshot%2FScreenshot_12.png) --- ## Part 3: Stack Diagram and Program Output @@ -40,9 +43,14 @@ Answer questions about stack diagrams and program output without running the pro 1. Draw a stack diagram that shows the state of the program the first time `ping` is invoked. * Hint: If you Google how to use IntelliJ's **BreakPoint** functionality, you can screenshot the **program state** instead of drawing it. * Regardless of your methodology, a picture of the programs state should be added to this Repo and committed. -2. What is the output by the following program? + * +![Screenshot_14.png](..%2F..%2FOneDrive%2FDocuments%2FLightshot%2FScreenshot_14.png) +3. 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,8 +63,14 @@ 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? +![Screenshot_16.png](..%2F..%2FOneDrive%2FDocuments%2FLightshot%2FScreenshot_16.png) +Method is invoked but result is not used. The answer is not displayed since it doesn't have the output code. + 2. What happens if you use a void method as part of an expression? For example, try `System.out.println("boo!") + 7;`. +![Screenshot_15.png](..%2F..%2FOneDrive%2FDocuments%2FLightshot%2FScreenshot_15.png) + + --- ## Part 5: Stack Diagram and Program Output @@ -68,10 +82,14 @@ Draw a stack diagram that shows the state of the program the second time `zoop` 1. Draw a stack diagram that shows the state of the program the second time `zoop` is invoked. * Hint: If you Google how to use IntelliJ's **BreakPoint** functionality, you can screenshot the **program state** instead of drawing it. * Regardless of your methodology, a picture of the programs state should be added to this Repo and committed. +* ![Screenshot_17.png](..%2F..%2FOneDrive%2FDocuments%2FLightshot%2FScreenshot_17.png) 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/src/RedesignDate.java b/src/RedesignDate.java new file mode 100644 index 0000000..2758803 --- /dev/null +++ b/src/RedesignDate.java @@ -0,0 +1,31 @@ +public class RedesignDate { + public static void newLine() { + System.out.println(); + } + + public static void printAmerican(int day, int year) { + System.out.print("Thursday, "); + System.out.print("February "); + System.out.print(day); + System.out.print(", "); + System.out.print(year); + } + public static void printEuropean(int day, int year) { + + System.out.print(day); + System.out.print(" February "); + System.out.println(year); + } + + public static void main(String[] args) { + int day = 8; + int year = 2024; + System.out.print("Today's date in American format is, "); + printAmerican(day, year); + newLine(); + System.out.print("Today's date in European format is, "); + printEuropean(day, year); + + + } +} \ No newline at end of file diff --git a/src/Screenshot_12.png b/src/Screenshot_12.png new file mode 100644 index 0000000..5927d5c Binary files /dev/null and b/src/Screenshot_12.png differ diff --git a/src/Screenshot_15.png b/src/Screenshot_15.png new file mode 100644 index 0000000..a15d7bc Binary files /dev/null and b/src/Screenshot_15.png differ diff --git a/src/Screenshot_16.png b/src/Screenshot_16.png new file mode 100644 index 0000000..1510096 Binary files /dev/null and b/src/Screenshot_16.png differ diff --git a/src/Screenshot_17.png b/src/Screenshot_17.png new file mode 100644 index 0000000..91ea381 Binary files /dev/null and b/src/Screenshot_17.png differ diff --git a/src/Zippo.java b/src/Zippo.java index 04581a4..efc099b 100644 --- a/src/Zippo.java +++ b/src/Zippo.java @@ -1,19 +1,23 @@ public class Zippo { - public static void baffle(String blimp) { + public static int add(int a, int b) { + return a + b; + } + + public static void baffle(String blimp) { //2 System.out.println(blimp); zippo("ping", -5); } - public static void zippo(String quince, int flag) { + public static void zippo(String quince, int flag) { //3 if (flag < 0) { System.out.println(quince + " zoop"); } else { System.out.println("ik"); baffle(quince); System.out.println("boo-wa-ha-ha"); + add(3,5); } - } - public static void main(String[] args) { - zippo("rattle", 13); } + + public static void main(String[] args) {zippo("rattle", 13);} //1 }