From 75bdbe893e353416d2b63a9828665a6ddea5cd8f Mon Sep 17 00:00:00 2001 From: Amy Gill Date: Thu, 8 Feb 2018 15:11:53 -0500 Subject: [PATCH 1/2] OMGGGGGGGGGGGGGG and special thanks to kris and leon --- src/main/java/Main.java | 51 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 50 insertions(+), 1 deletion(-) diff --git a/src/main/java/Main.java b/src/main/java/Main.java index 1dbc0cb..fc17491 100644 --- a/src/main/java/Main.java +++ b/src/main/java/Main.java @@ -1,9 +1,58 @@ /** * Created by iyasuwatts on 10/17/17. - */ + public class Main { public static void main(String[] args){ } } + + */ + + +/** + * Created by iyasuwatts on 10/17/17. + */ + +import java.util.Scanner; + +public class Main { + + public static void main(String[] args) { + + Scanner amy = new Scanner(System.in); + System.out.println("Dear user please choose a number."); + int userNum = amy.nextInt(); + + System.out.println("Hello dear user. Would you like to do some addition or some repeated addition? Please type" + + " 'add' for addition and 'repeated add' for repeated addition. NO OTHER ANSWERS WILL BE ACCEPTED."); + + amy.nextLine(); + + String userChoice = amy.nextLine(); + + int count = 0; + + if (userChoice.equalsIgnoreCase("add")) { + count = 0; + + // get sum + for (int i = 1; i <= userNum; i++) { + count += i; + } + } else if (userChoice.equalsIgnoreCase("repeated add")) { + count = 1; + // get product + for (int i = 1; i <= userNum; i++) { + count *= i; + } + + + } + System.out.println(count); + + } +} + + From 207e72cc863fa6156237749c2900f177a3899b61 Mon Sep 17 00:00:00 2001 From: Amy Gill Date: Thu, 8 Feb 2018 15:22:43 -0500 Subject: [PATCH 2/2] just a tiny bit of added snark --- src/main/java/Main.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/Main.java b/src/main/java/Main.java index fc17491..dc9d81e 100644 --- a/src/main/java/Main.java +++ b/src/main/java/Main.java @@ -25,7 +25,7 @@ public static void main(String[] args) { System.out.println("Dear user please choose a number."); int userNum = amy.nextInt(); - System.out.println("Hello dear user. Would you like to do some addition or some repeated addition? Please type" + + System.out.println("Ok. So glad you can follow directions. Would you like to do some addition or some repeated addition? Please type" + " 'add' for addition and 'repeated add' for repeated addition. NO OTHER ANSWERS WILL BE ACCEPTED."); amy.nextLine();