diff --git a/README.md b/README.md index 40c2bd8..d89d211 100644 --- a/README.md +++ b/README.md @@ -26,8 +26,13 @@ Review the flow of execution through the program [Zippo.java](src/Zippo.java), a **Questions to Answer In This README.md:** 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? -4. What is the output of this program? +3. What is the value of the parameter `blimp` when `baffle` gets invoked? +- rattle +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? +- If you call a value method but don't assign the value in the method to a variable, the value will not be used. The program will still compile and run. 2. What happens if you use a void method as part of an expression? For example, try `System.out.println("boo!") + 7;`. +- Compilation error, method println does not return a value. --- @@ -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/src/RedesignDate.java b/src/RedesignDate.java new file mode 100644 index 0000000..c0e9dcf --- /dev/null +++ b/src/RedesignDate.java @@ -0,0 +1,21 @@ +/** + * @author Trevor Hartman + * @author Alexei Iachkov + * @verison 1.0 + * @date 2-10-24 + */ + + public class RedesignDate { + public static void printAmerican(String day, int date, String month, int year) { + System.out.println(day + ", " + month + " " + date + ", " + year); + } + public static void printEuropean(String day, int date, int month, int year) { + System.out.println(day + ", " + date + "/" + month + "/" + year); + } + public static void main(String[] args) { + printAmerican("Saturday", 10, "February", 2024); + printEuropean("Saturday", 10, 2, 2024); + + } + + } diff --git a/src/Zippo.java b/src/Zippo.java index 04581a4..9c9753a 100644 --- a/src/Zippo.java +++ b/src/Zippo.java @@ -1,19 +1,19 @@ public class Zippo { - public static void baffle(String blimp) { - System.out.println(blimp); - zippo("ping", -5); + public static void baffle(String blimp) { //6 + System.out.println(blimp); //7 + zippo("ping", -5); //8 } - public static void zippo(String quince, int flag) { - if (flag < 0) { - System.out.println(quince + " zoop"); - } else { - System.out.println("ik"); - baffle(quince); - System.out.println("boo-wa-ha-ha"); + public static void zippo(String quince, int flag) { //2 + if (flag < 0) { //9 + System.out.println(quince + " zoop"); //10 + } else { //3 + System.out.println("ik"); //4 + baffle(quince); //5 + System.out.println("boo-wa-ha-ha"); //11 } } public static void main(String[] args) { zippo("rattle", 13); - } + } //1 } diff --git a/src/ping stack diagram.PNG b/src/ping stack diagram.PNG new file mode 100644 index 0000000..6ffacb3 Binary files /dev/null and b/src/ping stack diagram.PNG differ diff --git a/src/zoop stack diagram.PNG b/src/zoop stack diagram.PNG new file mode 100644 index 0000000..48968e9 Binary files /dev/null and b/src/zoop stack diagram.PNG differ