From 3d1a0924e482652de66d0c09270350e2e61867ba Mon Sep 17 00:00:00 2001 From: FinnCl4rk Date: Thu, 5 Oct 2023 12:50:46 -0700 Subject: [PATCH 1/2] Completed 006 - Javadocs --- .idea/misc.xml | 2 +- src/Lab006.java | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 src/Lab006.java diff --git a/.idea/misc.xml b/.idea/misc.xml index 7464918..d97e4c4 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/src/Lab006.java b/src/Lab006.java new file mode 100644 index 0000000..2b71eaf --- /dev/null +++ b/src/Lab006.java @@ -0,0 +1,33 @@ +import java.util.Scanner; + +public class Lab006 { + private int n; + private int m; + public int quotient; + public Lab006(int n, int m){ + this.n = n; + this.m = m; + } + 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(); + System.out.print(lab.quotient); + } + + +} From 544ce692cba9fe0a2dc64fd54024cee7edb0d556 Mon Sep 17 00:00:00 2001 From: FinnCl4rk Date: Sat, 7 Oct 2023 22:51:29 -0700 Subject: [PATCH 2/2] Updated Javadocs --- .idea/misc.xml | 2 +- README.md | 2 +- src/Lab006.java | 15 ++++++++++++--- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/.idea/misc.xml b/.idea/misc.xml index d97e4c4..69ace3f 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/README.md b/README.md index ae51dc5..d106a18 100644 --- a/README.md +++ b/README.md @@ -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** diff --git a/src/Lab006.java b/src/Lab006.java index 2b71eaf..2931ff9 100644 --- a/src/Lab006.java +++ b/src/Lab006.java @@ -1,13 +1,23 @@ +/*Finn Clark +* CIS - 12 +* Hartman +* 10/5/23 +* */ import java.util.Scanner; public class Lab006 { - private int n; - private int m; + 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){ @@ -26,7 +36,6 @@ public static void main(String[] args){ int y = scanner.nextInt(); Lab006 lab = new Lab006(x, y); lab.isDivisible(); - System.out.print(lab.quotient); }