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.:- M9718202

Have any Question?


Related Questions in Computer Engineering

Reading the biographybook where the body meets memory by

Reading the Biography Book : "Where the Body Meets Memory" by David Mura Questions: INFERENCE AND ANALYSIS QUESTION - Mura is particularly interested in using italics and different font types to represent different peopl ...

Question nested lists and cascading style sheetsdeliverable

Question: Nested Lists and Cascading Style Sheets Deliverable: Three (3) Web pages and two (2) Cascading Style Sheets (.css) Complete the weekly lab based on the following: • Write the code for each lab assignment. • The ...

You are the senior consultant at abacus consulting tasked

You are the Senior Consultant at Abacus Consulting, tasked with the database project for Amadeus Real Estate client. The company employs real estate agents who work with customers to buy and sell properties (both residen ...

You have a deck of magic the gathering cards with 60 cards

You have a deck of Magic the Gathering cards with 60 cards total. In the deck you have 20 Mana cards, 18 Spells, 3 Artifacts, 12 Creatures, 6 Enchantments and 1 Planes Walker. What is the probability that you draw 2 arti ...

Question suppose a process in host c has a udp socket with

Question : Suppose a process in Host C has a UDP socket with port number 6789. Suppose both Host A and Host B each send a UDP segment to Host C with destination port number 6789. Will both of these segments be directed t ...

Scenarioconsider the following situation your local grocery

Scenario Consider the following situation. Your local grocery store ran a contest where the contest winner was allowed to fill his/her car with however many groceries the winner could take home, at no cost to the contest ...

On crait 40 of the surviving resistance fightersnbspare

On Crait, 40% of the surviving resistance fighters are pilots. Preparing for KyloRen's assault on their position, a random sample of 25 resistance fighters is taken. Using this information, answer the following questions ...

Reusability of prior designs is critical when creating

Reusability of prior designs is critical when creating best-practice solutions in the enterprise. Capturing such designs provides useful guidance for Enterprise Architects. However, cataloguing such blueprints for reuse ...

Can someone help me answer these questions these are from

Can someone help me answer these questions? These are from Android Studio that you need answered for class. (1) What is "Minimum SDK" meaning in program? (2) Can "Wear Minimum SDK" API version be smaller than that of "Ph ...

Suppose that 75 of all trucks undergoing a brake inspection

Suppose that 75% of all trucks undergoing a brake inspection at a certain inspection facility pass the inspection. Consider groups of 15 trucks and let X be the number of trucks in a group that have passed the inspection ...

  • 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