questionwrite down a java program that asks the


Question

Write down a Java program that asks the user to enter two numbers x and b using Scanner and calculates logb(x), displaying the result using System.out.

Note that the Math.log(x) function returns the natural logarithm of x (ln(x)), so you will need to use the formula-
logb(x) =ln(x)/ln(b)

Your program has to use a while loop (or a do-while loop) to repeatedly ask the user for input until two valid numbers are entered. A number is considered valid if it is greater than zero.

Ask user to enter the value of x. If the input is not valid then print an suitable error message and ask for x again. keep on asking until a valid value for x is provided.

Repeat same process as above, but asking the user for b instead of x.

Once both numbers are input calculate logb(x) and show the result with System.out.

 

 

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: questionwrite down a java program that asks the
Reference No:- TGS0444096

Expected delivery within 24 Hours