Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

48 changes: 48 additions & 0 deletions src/Lab006.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/**
* Lab006 class.
* This class prompts the user for two integers and checks if the first integer is evenly divisible by the second integer.
*
* Justin Hart
* @version 1.0
*/




import java.util.Scanner;

public class Lab006 {
int n; // instance variable n
int m; // instance variable m

// constructor
public Lab006(int n, int m) {
this.n = n;
this.m = m;
}

// method to check divisibility
public boolean isDivisible() {
return (m != 0 && n % m == 0);
}

public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);

System.out.println("Enter the first integer:");
int n = scanner.nextInt();

System.out.println("Enter the second integer:");
int m = scanner.nextInt();

Lab006 obj = new Lab006(n, m);
boolean result = obj.isDivisible();

System.out.println("Is " + n + " evenly divisible by " + m + "? " + result);
}
}