Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Mobile Programming Final Exam -3 Student No: Name: Part 3: Program (80 points) 1. (14 points) Write an Android that allows a user to input the coefficients of a line equation and returns the triangle area formed by the line, x-axis, and y-axis. A possible run may look like: Enter the line ax The triangle area Enter the line ax The triangle area + by = c: 12 5 60 is 30.000000. + by = c: 3 4 12 is 6.000000. 2. (26 points) Write an Android game as follows: (a) (7 points) Generate a 4 by 4 board and fill the number from 1 to 16 and the numbers are hidden in the beginning. (b) (5 points) The player picks a number and the computer randomly picks another number. (c) (4 points) The one who has the larger points wins the points. (d) (5 points) Once the number is selected, it is exposed and cannot be selected again. (e) (5 points) Once all numbers are selected, calculate the points and announce who wins the game. A possible run may look like: Your points: 0 Computer’s points: 0 * * * * * * * * * * * * * * * * Enter Your pick => 2 2 Computer’s pick => 3 1 Your points: 0 Computer’s points: 18 * * * * * 8 * * 10 * * * * * * * ... 6 16 1 12 2 8 13 5 10 4 9 14 7 15 3 11 Your points: 71 Computer’s points: 65 Congratulation! You win the game. Hint: import java.util.Random; Ramdon r; r.nextInt(n); 3. (40 points) (a) (12 points) Write a server program which receives two fraction numbers and the operator from the client and return the result of the addition, substraction, multiplication, and divsion of these two fraction numbers in the reduced form to the client (b) (28 points) Write an Android client that allows a user to input two fraction numbers and the operator and submit them to the server and then receive the result from the server. A possible run may look like: 3/4 3/4 3/4 3/4 + * / 2/3 2/3 2/3 2/3 = = = = 17/12 1/12 1/2 9/8 (If (If (If (If the the the the user user user user selects selects selects selects +.) -.) *.) /.)