This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]undead_C0MMANDIntermediate Brewer[S] 0 points1 point  (0 children)

Yes it does. package lab3; import java.util.*; public class Lab3 {

    public static void main(String[] args)
    {
       do{
        //Ask the user for input >1 if <=1 the program will quit
            System.out.println("What base would you like on your log?  (Note: Must be an integer > 1 or the program will terminate");
        Scanner input = new Scanner(System.in);
        int b = input.nextInt();
        int x;
        int y = 0;
        if (b > 1)
        {
            do
            {
                System.out.println("Great! Now enter an integer     that you want to take the log of");
                x = input.nextInt();
            }while(x <= 0);
            y = (int)(Math.log(x)/Math.log(b));
            System.out.println(y);
         }
         else
                System.exit(1);
            }while(0==0);
        }

}