import java.util.Scanner;
public class Conversion
{
static Scanner input = new Scanner(System.in);
static int base = input.nextInt();
static int number = input.nextInt();
static int result;
/**
* Your main method does the following steps repeatedly until the user enters
* 0 for the number base:
*
* Obtain the number base for the next number using Scanner
* Call the getNumberInBase method to get a number in that base from the user.
* Call convertToDecimal using the number and base obtained.
* Call the printResults method, passing the number, base and result of
* calling the convertToDecimal method.
*
*/
public static void main(String[] args)
{
while(base!=0){
getNumberInBase(input,base);
convertToDecimal(number,base);
printResults(number,base,result);
}
}
/**
* Prompts the user to enter a number in the given base. Input comes from the
* Scanner object. The input must be passed to the isValidNumber method to
* determine if the number is a valid number for that base. Print an error
* message if it is not valid and then prompt the user to enter a nother number.
* This continues until the user provides a valid number for the given base.
*
* Return only a number that is valid for the given base
*/
public static int getNumberInBase(Scanner scanner, int base)
{
System.out.print("Enter a number base: ");
while(!isValidNumber(number,base)){
System.out.println("That is an invalid number for base " + base +". Try Again");
getNumberInBase(input,base);
}
return base;
}
/**
* returns true if the number is a valid number for the given base. Otherwise
* the method returns false.
*/
public static boolean isValidNumber(int number, int base)
{
return false;
}
/**
* Returns the decimal equivalent of the number in the given base.
*
* Pre condition: number is a valid number for the given base
* Post condition: returns the decimal value of the number.
*/
public static int convertToDecimal(int number,int base)
{
if(isValidNumber(number,base)){
}
return 0;
}
/**
* Prints the statement:
*
* The base <base> number <number> is <result> in base 10.
*
*/
public static void printResults(int number, int base, int result)
{
}
}

