Question: Write the JAVA script for the following. Note: Since all the programs run on Zybooks compiler use tha name for each program as Main. Ex:
Write the JAVA script for the following.
Note: Since all the programs run on Zybooks compiler use tha name for each program as Main.
Ex: public class Main {
1. Ask for a word and then use the String length() operation to display the word length.
2. Ask for a number. Calculate and display the square root using a Math operation.
3. Ask for two numbers that represent the lengths of right triangle legs. Use Math operations to calculate and display the length of the third side (i.e. hypotenuse). Remember the Pythagorean theorem?
4. Ask for a word and then use the String substring() operation to display the first three letters.
5. Ask for a word and then use the String substring() operation to display the last three letters.
6. Ask for a word and then use the String substring() operation to display the middle three letters. Assume the word length is always odd and at least three.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
