Write a Java application that lists your top five favorite movies Each movie sho
ID: 3786442 • Letter: W
Question
Write a Java application that lists your top five favorite movies Each movie should also is year of release and its running time in hours minutes format Use the escape sequence for tabs line up the movie titles, years, and running times For example program's output might look The Best Movies Ever, According to Me Monty Python and the Holy Grail 1975 1: 31 The Count of Monte Cristo 2001 2: 11 Office Space 1999 1: 29 Forrest Gump 1994 2: 22 Terminator 2: Judgment Day 1991 2: 17 If you don't know the years and running times by heart (which I truly hope you don't...), you can up detailed movie information online through the Internet Movie Database at www.imdb.com. Although Java does not have an operator for exponentiation, you can accomplish using the Math.pow(base, exponent) method For example, in the following statement System.out.println(Math.pow(2. 3)); the base is 2 and the exponent is 3, and since 2^3 - 8, the statement will print 8 0 (The data type, of the value returned by Math.pow is always a double, i e., double-precision floating point number.) And the statement System.out.println (Math.pow(2, 2) + Math.pow(2, 3)); will print 12.0 since 2^2 + 2^3 = 4.0 + 8.0 = 12.0. Finally, the statement System.out.println(2 * Math.pow(16, 3) + 2 * Math.pow(16, 2); will print 8704.0 because 2 times 16^3 + 2 times 16^2 = 2 times 4096.0 + 2 times 256.0 = 8704.0. Using the Math.pow(base, exponent) method, write System.out.println statements with appropriate expressions to convert each of the following to base 10: (11100)_2 (777)_8 (ABC)_16 (DEF)_16Explanation / Answer
(11100)2 --> System.out.println( 1 * Math.pow(2,4) + 1 * Math.pow(2,3) + 1 * Math.pow(2,2) + 0 * Math.pow(2,1) + 0 * Math.pow(2,0) ); will print 28 because 1 * 24 + 1 * 23 + 1 * 22 + 0 * 21 + 0 * 20 (777)8 --> System.out.println( 7 * Math.pow(8,2) + 7 * Math.pow(8,1) + 7 * Math.pow(8,0) ); will print 511 because 7 * 82 + 7 * 81 + 7 * 80 (ABC)16 --> System.out.println( 10 * Math.pow(16,2) + 11 * Math.pow(16,1) + 12 * Math.pow(16,0) ); will print 2748 because 10 * 162 + 11 * 161 + 12 * 160 (DEF)16 --> System.out.println( 13 * Math.pow(16,2) + 14 * Math.pow(16,1) + 15 * Math.pow(16,0) ); will print 3567 because 13 * 162 + 14 * 161 + 15 * 160
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.