Download presentation
Presentation is loading. Please wait.
1
Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved. 0136012671 1 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=0.9032258064 The Result is Y=9.032258e-01 The Result is Y=0.903226
2
Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved. 0136012671 2 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
3
Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved. 0136012671 3 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!
Similar presentations
© 2025 SlidePlayer.com Inc.
All rights reserved.