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?

1. If you invoke a value method and don't do anything with the returned result, IntelliJ will throw an error saying that a returned result is being ignored. The returned value should be used in a method or assigned to a variable. If neither, then the block should have a void return type.
## 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
42 changes: 42 additions & 0 deletions src/Lab006.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*Finn Clark
* CIS - 12
* Hartman
* 10/5/23
* */
import java.util.Scanner;

public class Lab006 {
final private int n;
final private int m;
public int quotient;
public Lab006(int n, int m){
this.n = n;
this.m = m;
}

/**Setting the n%m quotient to the public instance variable "quotient"
* No parameters
* @return boolean true if divisible or false if not
*/
public boolean isDivisible(){
this.quotient = n%m;
if (quotient == 0){
System.out.println("You're numbers are divisible! :D");
return true;
} else {
System.out.println("Your numbers are indivisible :(");
return false;
}
}
public static void main(String[] args){
Scanner scanner = new Scanner(System.in);
System.out.println("Give me an integer: ");
int x = scanner.nextInt();
System.out.println("Give me another integer: ");
int y = scanner.nextInt();
Lab006 lab = new Lab006(x, y);
lab.isDivisible();
}


}