import java.util.Scanner;

public class BaseX {
  
  public static void main(String[] args){
    
    Scanner scan = new Scanner(System.in);
    String input = "";
    int base = 0;
    
    // Prompt the user to specify a base between 2 and 
    // 10, and store that value in the variable "base"
    // Force the user to give a value in that range.



    // So long as the String input is NOT 1-8 in length,
    //    Ask the user to enter a valid base-X number up to 8 digits
    //    Save the next line of user input to the variable "input"




    
    
    // If the input string is NOT base-X, tell the user "Bad input!"
    // Otherwise, tell the user "You entered [numeric value of input]"
    // You can call the methods like so:
    //      isBaseX(input, base)      This will give you a true or false value
    //      baseXValue(input, base)   This will give you an int value



    
  }
  
  private static boolean isBaseX(String input, int base){
    

    // Go over each character of input
    //      If that single character is NOT a valid digit of that base, return false immediately
    // If you finish going through the characters, return true






    return true;
  }
  
  private static int baseXValue(String input, int base){
    int result = 0;

    // To start, the exponent is 0 and the next position in 
    // in the input string is the string length minus one.  
    // You already have an int variable to hold your result.







    // While the exponent is smaller than the string length, 
    //     Get the character at the next position in the input string
    //        and store it in a char variable
    //     Subtract '0' (not 0) from that character and multiply 
    //         the result of that subtraction by (int) Math.pow(base, exponent)
    //     Add the product to "result"






    
    return result;
  }
  
}
You will need to do the following things:
  1. Get a String of input from the user.
  2. Depending on whether the input is valid, announce the number's value; otherwise, let the user know it is bad input.
  3. Write a method to verify whether or not the user's input string is valid.
  4. Write a method to calculate the value of the user's input string.
Note that because of user input, the output will look different each time you run the program. When running the program, you can use this site to check the correctness of your program's solution.

Program output examples:

Specify your base (2-10): 2

Enter a valid base-2 number up to 8 digits long:
10111010
You entered 186

Specify your base (2-10): 7

Enter a valid base-7 number up to 8 digits long:
20132601
You entered 1672077

Specify your base (2-10): 4

Enter a valid base-4 number up to 8 digits long:
10140013
Bad input!
        
Question: How did the process of editing this program go for you? What were your main challenges and how did you overcome them? What did you learn that may be of use as you move along in this class?