Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved Java Programming Practice 4. Write a Java program to calculate the following formula. Where: a=8 b=6 c=5 x=2 NOTE: Use both System.out.println(….) statement and System.out.printf(….) to show your output. Output: The Result is Y= The Result is Y= e-01 The Result is Y=
Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved Java Programming Practice 5) Write a Java program which asks from the user the length of the edges of a right triangle as inputs and then determine the length of the hypotenuse. Output: Enter the length of edge1: 3 Enter the length of edge2: 4 The length of hypotenuse: 5
Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved Java Programming Practice 6) Write a Java program to read a string as input password, then compare it with a constant default password. If they are same, print to the output console “OK”, otherwise print “Password is Not Correct”. Output: Enter the password: I like Java! Password is Not Correct!