Question: Create the following programs in Java, {As simple as possible for a Java1 student} a. Ask the user to input a number and pass this

Create the following programs in Java, {As simple as possible for a Java1 student}

a. Ask the user to input a number and pass this number to a method. The method will double the number and return the result. Be sure to print the result on the screen.

b. Ask the user for an integer. Pass this integer into two methods. The first method returns the square of the integer passed to it, and the second method returns the cube. Print the results.

c. The harmonic mean of two numbers is obtained by averaging the inverse of the two numbers and then taking the inverse of the result Write a method that takes two integer arguments and returns the harmonic mean of the two numbers. Ask the user for two integers, invoke your method, then print the harmonic mean.

Note, avoid integer division!

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!