From c9b690a905e796570f044b5d1ab2feebff8296ef Mon Sep 17 00:00:00 2001 From: Dylan Camac Date: Wed, 7 Feb 2018 17:16:49 -0500 Subject: [PATCH 1/3] commit this --- src/main/java/Main.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/Main.java b/src/main/java/Main.java index 1dbc0cb..386789b 100644 --- a/src/main/java/Main.java +++ b/src/main/java/Main.java @@ -3,6 +3,8 @@ */ public class Main { + // comment comment + public static void main(String[] args){ } From 11d658107f3dee98c3580ddc366e323b7c2e5613 Mon Sep 17 00:00:00 2001 From: Dylan Camac Date: Thu, 8 Feb 2018 09:05:30 -0500 Subject: [PATCH 2/3] saved --- src/main/java/Main.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/main/java/Main.java b/src/main/java/Main.java index 386789b..3cc760c 100644 --- a/src/main/java/Main.java +++ b/src/main/java/Main.java @@ -1,11 +1,27 @@ /** * Created by iyasuwatts on 10/17/17. */ + import java.util.Scanner; + + public class Main { // comment comment + + public static void main(String[] args){ + Scanner scan = new Scanner(System.in); + + System.out.println("Input a number"); + int input = scan.nextInt(); + System.out.println("Would you like the sum or product of " + input + "?"); + String preference = scan.nextLine(); + + if (preference.equalsIgnoreCase("sum")) { + + } + } } From 8c5393ea830649b6f41a19501b3f5b8ce5e38096 Mon Sep 17 00:00:00 2001 From: Dylan Camac Date: Thu, 8 Feb 2018 14:45:15 -0500 Subject: [PATCH 3/3] saver saves --- src/main/java/Main.java | 43 ++++++++++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/src/main/java/Main.java b/src/main/java/Main.java index 3cc760c..67621ae 100644 --- a/src/main/java/Main.java +++ b/src/main/java/Main.java @@ -1,7 +1,8 @@ /** * Created by iyasuwatts on 10/17/17. */ - import java.util.Scanner; + +import java.util.Scanner; public class Main { @@ -9,19 +10,35 @@ public class Main { // comment comment - - public static void main(String[] args){ + public static void main(String[] args) { Scanner scan = new Scanner(System.in); - - System.out.println("Input a number"); - int input = scan.nextInt(); - System.out.println("Would you like the sum or product of " + input + "?"); - String preference = scan.nextLine(); - - if (preference.equalsIgnoreCase("sum")) { - + Scanner secondScan = new Scanner(System.in); + + System.out.println("Input a number"); + int input = scan.nextInt(); + int sumTotal = 0; + int productTotal = 1; + + System.out.println("Would you like the sum or product of " + input + "?"); + String userInput = secondScan.nextLine(); + + if (userInput.equalsIgnoreCase("sum")) { + for (int i = 0; i <= input; i++) { + sumTotal += i; + } + System.out.println("The sum of your number is " + sumTotal); + + } else if (userInput.equalsIgnoreCase("product")) { + for (int i = 1; i <= input; i++) { + productTotal *= i; + + } + System.out.println("The product of your number is " + productTotal); + } else { + System.out.println("Invalid command, try again"); + } } - } -} + +} \ No newline at end of file