diff --git a/.idea/misc.xml b/.idea/misc.xml index 7464918..958a34c 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,5 @@ - - + \ No newline at end of file diff --git a/README.md b/README.md index ae51dc5..08eb48c 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? +* Answer: Nothing would happen. ## 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..46b82c1 --- /dev/null +++ b/src/Lab006.java @@ -0,0 +1,41 @@ +/** + * + * @author Trevor Hartman + * @author Cameron Meng + * + * @since Version 1.0 + * + */ +import java.util.Scanner; +public class Lab006 { + private int n; + private int m; + public Lab006(int n, int m) { + this.n = n; + this.m = m; + } + public boolean isDivisible() { + if (n % m == 0) { + return true; + } else { + return false; + } + } + public static void main(String[] args) { + Scanner s = new Scanner(System.in); + System.out.println("Give me an integer"); + int x = Integer.parseInt(s.nextLine()); + + System.out.println("Would you mind giving me a second integer"); + int y = Integer.parseInt(s.nextLine()); + + Lab006 labObject = new Lab006(x, y); + boolean result = labObject.isDivisible(); + + if (result) { + System.out.println("The first integer is divisible by the second integer."); + } else { + System.out.println("The first integer is not divisible by the second integer."); + } + } +}