Question: Exercise 1: Practice with mathematical expressions (10 points) Write a java program that prompts the user for 3 double precision floating point values x, y
Exercise 1: Practice with mathematical expressions (10 points)
Write a java program that prompts the user for 3 double precision floating point values x, y and z. Have the program compute and display the following values.
the average (mean) of x, y and z
the cosine of x plus y divided by z cos((x + y) / z)
the cube root of x
the value of x raised to the power of y
the log10 of x
To access the library functions sin, cos and log10, you need to import java.lang.Math class at the top of your code.
Exercise 2: Unit conversion (10 points)
Write a java program that converts meters into feet and inches. The program starts by asking the user for a measurement in meters. The program should accept a floating point number. After getting the number, the program computes the number of feet and inches equal to the specified number of meters. The program outputs feet and inches as whole numbers. The program should round the number of inches correctly. Test that your program produces the following outputs for the given inputs.
| Input | Output |
| 1 | 3 ft 3 in |
| 2 | 6 ft 7 in |
| 0.3049 | 1 ft 0 in |
| 0.3048 | 1 ft 0 in |
| 0.3047 | 1 ft 0 in |
There are 39.3700787 inches in a meter.
Make sure code is well organized
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
