diff --git a/.idea/misc.xml b/.idea/misc.xml index 7464918..5ad49fe 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/README.md b/README.md index ae51dc5..d36eda8 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ In this README.md, answer the following question: * What happens if you invoke a value method (i.e. a method that returns a result) and don't do anything with the returned result; that is, if you don't assign the returned result to a variable or use it as part of a larger expression? +It falls off the stack? ## PART 2 * Fork and clone this lab as you have done in all previous labs, and then complete the following: * Create a new **class** called **Lab006** diff --git a/src/Lab006.java b/src/Lab006.java new file mode 100644 index 0000000..731c367 --- /dev/null +++ b/src/Lab006.java @@ -0,0 +1,26 @@ +import java.util.Scanner; +public class Lab006 { + private int n; + private int m; + public Lab006(int userN, int userM) { + this.n = userN; + this.m = userM; + } + public boolean isDivisible () { + return n % m == 0; + } + + public static void main(String[] args) { + Scanner in = new Scanner(System.in); + System.out.println("Please type in a number and press enter:"); + int userN = in.nextInt(); + System.out.println("Please type in another number and press enter:"); + int userM = in.nextInt(); + Lab006 lab6 = new Lab006(userN, userM); + if (lab6.isDivisible()){ + System.out.printf("%s is divisible by %s.", userN, userM); + } else { + System.out.printf("%s is not divisible by %s.", userN, userM); + } + } + } \ No newline at end of file