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: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +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 result will be discarded and the IDE may ignore.
## 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
34 changes: 34 additions & 0 deletions src/Lab006.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import java.util.Scanner;
/**
* Steven Fraga, 10/7/23
*/
public class Lab006 {
int n, m;

/**
* Constructer class Lab006 takes 2 integers, and assigns them to Lab006 instance variable
*/
public Lab006 (int n,int m) {
this.n = n;
this.m = m;
}

/**
* Tests whether first integer "n" is evenly divisible by second integer "m"
* @param n first integer input
* @param m second integer input
* @return true if n is evenly divisible, false otherwise
*/
public static boolean isDivisible (int n, int m) {
return n % m == 0;
}
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
System.out.println("Enter the first integer: ");
int firstInteger = s.nextInt();
System.out.println("Enter the second integer: ");
int secondInteger = s.nextInt();
Lab006 labTest = new Lab006(firstInteger, secondInteger);
System.out.println(isDivisible(labTest.n, labTest.m));
}
}