40 likes | 167 Views
Open Powerpoint 1.4 Also open the assignment Middle. Java’s Math class. Allows you to do basic math functions Not necessary to import it 3 methods you must know: Math.abs ( num ) // find the absolute value of num Math.pow (base, exp ) // raises base to the exp power
E N D
Open Powerpoint 1.4 • Also open the assignment Middle
Java’s Math class • Allows you to do basic math functions • Not necessary to import it • 3 methods you must know: • Math.abs(num) // find the absolute value of num • Math.pow(base, exp) // raises base to the exp power • Math.sqrt(num) // finds the square root of num • Demo: MathDemo
Assignments • Review powerpoint 1.4, especially the substring example. • (Lettahs) Prompt the user to enter their full name (on one line, not separately). Then…. • If the user forgot to enter a space, make them try again until they get it right. • Display the number of characters in the name (not including the space). • Display the 1st letter, the 3rd letter, and the last letter (of the full name). • Display the name in all caps. • If the letters A and Z are both in the name, display “both.” • Display the characters from index #4 to (and including) index #6 • Display the characters from index #2 to the end of the name • Display the person’s initials only. • (QBrating) Click here for the NFL QB Rating Formula. (Take note of the line “a, b, c, and d can not…) Also, look up any NFL QB’s 2013 stats (completions, attempts, yards, TDs, and INTs). Then, write a program that asks the user for those 5 stats, and displays the correct QB rating.