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.

3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ 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?

- When you invoke a method that returns a value and don't do anything with the returned result, the result is simply discarded


## 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**
Expand Down
50 changes: 50 additions & 0 deletions src/Lab006.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import java.util.Scanner;

public class Lab006 {

int n;

int m;


// n The first integer value.
// m The second integer value.

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

// check if n is divisable by m

public boolean isDivisble(){
return (n % m) == 0;

}
// main method which handles getting the user input and displaying the result
public static void main(String[] args) {
int number1;
int number2;
Scanner scan = new Scanner(System.in);
System.out.println("Enter the integer: ");
number1 = scan.nextInt();
System.out.println("Enter the integer: ");
number2 = scan.nextInt();
Lab006 labObject = new Lab006(number1, number2);

boolean result = labObject.isDivisble();
if (result){
System.out.println(number1 + " is evenly divisible by " + number2);
}
else {
System.out.println(number1 + " is not evenly divisible by " + number2);
}

}






}