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..0731c1a 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,15 @@ 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? +4. ## There are two methods; zippo and baffle. These methods basically work together to print out a complete message. +5. ## the beginning method basically , baffle, only requires 1 variable to be called and used correctly. Then zippo +6. ## changes the string variable "quince" from "rattle" to "ping", prints the words "ping zoop", then "boo-wa-ha-ha" 4. What is the output of this program? +5. ## The output of the program is the following text: +6. "ik + rattle + ping zoop + boo-wa-ha-ha" --- @@ -43,6 +51,8 @@ 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 + ik + breakpoint reached ``` @@ -55,8 +65,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? +2. ## invoking a method can be done as many times as needed, but the method has to be actually used or else it will throw codes. 2. What happens if you use a void method as part of an expression? For example, try `System.out.println("boo!") + 7;`. - + ## using a void method as part of an expression is allowed and encouraged. --- ## Part 5: Stack Diagram and Program Output @@ -71,7 +82,9 @@ 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 +breakpoint reached ``` ## Submission diff --git a/src/Method Breakpoint 2.png b/src/Method Breakpoint 2.png new file mode 100644 index 0000000..d10f5cb Binary files /dev/null and b/src/Method Breakpoint 2.png differ diff --git a/src/Method Breakpoint.png b/src/Method Breakpoint.png new file mode 100644 index 0000000..30d9f27 Binary files /dev/null and b/src/Method Breakpoint.png differ diff --git a/src/RedesignDate.java b/src/RedesignDate.java new file mode 100644 index 0000000..f026a94 --- /dev/null +++ b/src/RedesignDate.java @@ -0,0 +1,37 @@ +public class RedesignDate { + public static void main(String[] args) { + + //Call the American method + printAmerican(25, 2024); + //Call the European method + printEuropean(25, 2024, 1); + + } +//Declare the american method +public static void printAmerican(int date, int year){ + + + String day = "Thursday"; + date = 25; + String month = "January"; + year = 2024; + + + System.out.println("American:" + day + ", " + month + " " + date + ", " + year); + } + public static void printEuropean(int date, int year, int monthEU) { + + String day = "Thursday"; + date = 25; + String month = "January"; + + monthEU = 1; + year = 2024; + + + System.out.println("European:" + year + "-" + monthEU + "-" + date); + + + } + +} \ No newline at end of file diff --git a/src/Zippo.java b/src/Zippo.java index 04581a4..7181420 100644 --- a/src/Zippo.java +++ b/src/Zippo.java @@ -1,19 +1,20 @@ public class Zippo { - public static void baffle(String blimp) { - System.out.println(blimp); - zippo("ping", -5); - } - 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 baffle(String blimp) { //1 + System.out.println(blimp); //2 + zippo("ping", -5); //3 + } //4 + public static void zippo(String quince, int flag) { //5 + if (flag < 0) { //6 + System.out.println(quince + " zoop"); //7 + } else { //8 + System.out.println("ik"); //9 + baffle(quince); //10 + System.out.println("boo-wa-ha-ha"); //11 + } //12 + }//13 public static void main(String[] args) { zippo("rattle", 13); - } -} + + } //14 +} //15