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.

2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ 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:
* What happens if you invoke a value method and don't do anything with the returned result is the code runs but the value isn't stored or used it is pretty much ignored.
## 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
53 changes: 53 additions & 0 deletions src/Lab006.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/**
* Author - Joseph Verdin
* Date - 10/28/23
*/

import java.util.Scanner;
public class Lab006 {
private int n;
private int m;

/**
* Created constructor for class Lab006 that takes two ints and assigns them to the Lab 006 instance variables.
* @param n 1st integer
* @param m 2nd integer
*/
public Lab006(int n, int m) {
this.n = n;
this.m = m;

}

/**
* Checks if 1st int is able to be evenly divided by the 2nd int
* @return True if n can be evenly divided by m if not is false
*/
public boolean isDivisible() {
return n % m == 0;
}

/**
* Main method that asks user for two integers and uses the isDivisible method to check if they can be evenly divided then prints the answer
* @param args no arguments
*/
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);

System.out.println("Enter Integer 1: ");
int num1 = scanner.nextInt();
System.out.println("Enter Integer 2: ");
int num2 = scanner.nextInt();

Lab006 Labobj = new Lab006(num1, num2);

boolean result = Labobj.isDivisible();
if (result) {
System.out.println(num1 + " Can be evenly divided by " + num2);
} else {
System.out.println(num1 + " Can not be evenly divided by " + num2);
}


}
}