Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

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.

 

 

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M9132950

Have any Question?


Related Questions in Computer Engineering

Remembering the pythagorean theorem - the square of the

Remembering the Pythagorean Theorem - The square of the hypotenuse is equal to the sum of the squares of the other two sides Your assignment is to design a Fortran 95 program with three solutions for the quadratic equati ...

Question suppose we have 29 bytes of virtual memory and 27

Question : Suppose we have 29 bytes of virtual memory and 27 bytes of physical main memory. Suppose the page size is 23 bytes. (a) How many pages are there in virtual memory? (b) How many page frames are there in main me ...

You have been recently hired as a senior database

You have been recently hired as a senior database administrator. Your organization has many SQL Server databases that run various applications. Your manager has asked you to present to the junior database administrators ...

1 what is the boolean expression for an and gate2 what is

1. What is the Boolean expression for an AND gate? 2. What is the Boolean expression for an OR gate? 3. What is the Boolean expression for a NOT gate?

Question cyber attacks on critical infrastructures-a risk

Question: Cyber Attacks On Critical Infrastructures-A Risk To The Nation There has been a great deal of research related to cyber attacks and vulnerabilities and critical infrastructure, but there is an incomplete unders ...

Simulate by matlab then solve it theory1- using simulations

Simulate by MATLAB then solve it theory. 1- Using simulations, generate a vector of normally distributed RV X with a mean mX equals 73 and standard deviation of 20% of the mean. 2-Using simulated vectors, find the probab ...

Question suppose you are asked to automate the prescription

Question : Suppose you are asked to automate the prescription fulfillment system for a pharmacy, MailDrugs. When an order comes in, it is given as a sequence of requests, "x1 ml of drug y1," "x2 ml of drug y2," "x3 ml of ...

Round robin rr jobs are processed using a fixed time-slice

Round Robin (RR): Jobs are processed using a fixed time-slice. The jobs are initially kept in a queue based on the order of arrival. The job at the front of the queue is removed and served similar to the FIFO algorithm. ...

You are saving up to buy a toyota tundra which costs 35000

You are saving up to buy a Toyota Tundra, which costs $35000 now. You don't think the price of the Toyota will change over the next two years. You don't want to borrow to pay any of this cost. You now have $10000 toward ...

Question describe specifically how the organization will

Question: Describe specifically how the organization will formulate a business performance plan, as follows: • Conduct a current situation analysis. • Determine the planning horizon. • Conduct an environmental scan. • Id ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As