Math & CS

Math 240 Fall 2015 Extra Credit Choose one of the following problems to submit on or before Monday, December 14 (the first day of final exams). If complete and correct, you will earn homework extra credit equivalent to one homework assignments (10 additional points for your homework score). To submit your program, please email me your Java file. 1. Write a Java program that generates the first k terms of the following sequences: (a) the Fibonacci sequence (b) the sequence in Section 5.1 Exercise #3 (c) the sequence in Section 5.6 Exercise #7 At run time, your program should display the list above and prompt the user to specify which sequence they’d like and k (the number of terms they’d like generated). Your program should then display the first k terms of the specified sequence. 2. Write a Java program that calculates truth values for the following statement forms: (a) p∧(q∨r) (b) p∧¬q → r (c) p∨¬q ↔ q∨r At run time, your program should display the list above and prompt the user to specify which statement form they’d like and a truth assignment for the statement variables p, q, and r. Your program should then display the truth value of the specified statement form for the given truth value assignments for the statement variables. 3. Write a Java program to use a repeated division algorithm to convert any integer from decimal notation to hexadecimal notation (base 16). For a definition of hexadecimal notation, see page 91 of our textbook. (Hint: our textbook describes an algorithm using repeated division to convert an integer from decimal notation to binary (base 2).) File #1