diff --git a/.idea/misc.xml b/.idea/misc.xml index 7464918..cf9abe6 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..fa77d00 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,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? + **The returned result will be ignored unless assigned to a variable** ## PART 2 * Fork and clone this lab as you have done in all previous labs, and then complete the following: diff --git a/src/Lab006.java b/src/Lab006.java new file mode 100644 index 0000000..a2d81a8 --- /dev/null +++ b/src/Lab006.java @@ -0,0 +1,47 @@ +/** + * @author Taylor Christie + * @date 10/5/2023 + */ + +import java.util.Scanner; +public class Lab006 { + private int n; + private int m; + + /** + * Lab006 Constructor + * @param user1 First integer inputted by user + * @param user2 Second integer inputted by user + */ + public Lab006(int user1, int user2) { + this.n = user1; + this.m = user2; + } + + /** + * Takes the inputted integers and checks if they're evenly divisible + * @return true or false + */ + public boolean isDivisible() { + if (n % m == 0) { + return true; + } else { + return false; + } + } + + /** + * Prompts user for integers and calls the isDivisible method + * @param args + */ + public static void main (String[] args) { + Scanner scan = new Scanner(System.in); + System.out.println("Type in your first integer: "); + int user1 = scan.nextInt(); + System.out.println("Type in the number you wish to divide the first integer by: "); + int user2 = scan.nextInt(); + Lab006 name = new Lab006(user1, user2); + boolean divisible = name.isDivisible(); + System.out.println("The integers were evenly divisible - " + divisible); + } +}