1 import java.util. Scanner; 2 public class NewMain7 3 { 4 public static void main(String[] args) 5 { 6 Scanner keyedInput = new Scanner(System.in); 7 8 int choice, firstNum, secondNum, answer; 9 System.out.println ("-------SUPER-------"); 10 System.out.println ("-------CHOICE------"); 11 System.out.println ("------PROGRAM------"); 12 System.out.println (); 13 System.out.println ("You may select one of the following options:" ); 14 System.out.println ("1... Add to numbers" ); 15 System.out.println ("2... Double up a number a given number of times" ); 16 System.out.println ("3... Determine the factorial of a given number"); 17 System.out.print ("Enter your choice: "); 18 19 choice = keyedInput.nextInt(); 20 System.out.println (); 21 22 if (choice ==1) 23 { 24 System.out.print ("Enter the first number: "); 25 firstNum = keyedInput.nextInt(); 26 System.out.print ("Enter the second number: "); 27 secondNum = keyedInput.nextInt(); 28 answer = firstNum + secondNum; 29 System.out.println (); 30 System.out.println ("The number " + firstNum + " added to " + secondNum + " equals: " + answer); 31 } 32 else if (choice ==2) 33 { 34 System.out.print ("Enter the number you would like to double: ");firstNum = keyedInput.nextInt(); 35 System.out.print ("Enter the number of times you would like to double it: "); 36 secondNum = keyedInput.nextInt(); 37 answer = firstNum; 38 39 for (int i=1; i<= secondNum; i++) 40 { 41 answer = answer * 2; 42 } 43 44 System.out.println (); 45 System.out.println ("The number " + firstNum + " doubled " + secondNum + " times equals: " + answer); 46 } 47 else if (choice ==3) 48 { 49 System.out.print ("Enter the number for which you would like to determine the factorial: "); 50 firstNum = keyedInput.nextInt();answer = 1; 51 52 for (int i=1; i<= firstNum; i++) 53 { 54 answer = answer * i; 55 } 56 57 System.out.println (); 58 System.out.println ("The factorial of the number " + firstNum + " is " + answer); 59 } 60 61 else 62 { 63 System.out.println ("Sorry, that choice is invalid"); 64 } 65 66 System.out.println (); 67 System.out.println ("-------SUPER-------"); 68 System.out.println ("-------CHOICE------"); 69 System.out.println ("------PROGRAM------"); 70 } 71 72 } 73 74 75