CIS457 Advance Java Programming Instr. Dr. Jongwook Woo Due Date - Your Java files 02/16/2005 midnight by email; - Your hardcopy of the Java files to the instructor before the lecture starts on 02/17/2005 Homework 2 (100%) 1. (50%) Design and implement a class called PairOfDice, composed of two six sided Die objects with the given Die class. You can test the class with the given BoxCars class. 2. (50%) Using the PairOfDice class from question 1, complete the classes such as Pig and PigPlayer, especially for the statements with the comment “//?” .You can test the class with PlayPig class given. a. This is the game called Pig b. In this game, the user competes against the computer based on the following rules. Most of rules are already implemented in PigPlayer class. Thus, you should complete the incomplete parts with the comment “//?” only. 1. On each turn, the current player rolls a pair of dice and accumulates points. The goal is to reach 100 points before your opponent does. 2. If, on any turn, the player rolls a 1, all points accumulated for that round are forfeited and control of the dice moves to the other player. 3. If the player rolls two 1s in one turn, the player loses all points accumulated thus far in the game and loses the control of the dice. 4. The player may voluntarily turn over the dice after each roll. Therefore, the player must decide to either roll again (be a pig) and risk losing points, or relinquish control of the dice, possibly allowing the other player to win. 5. Implement the computer player such that it always relinquishes the dice after accumulating 20 or more points in any given round. Note: a) If you see classes unfamiliar, you may refer to API link in the course web. b) It is not allowed to change the file. You have to only add codes by following the direction in the comment “//?” c) You have to submit only class PairOfDice, class Pig, and class PigPlayer. You should submit your java code by email. - Email format - You must email at the instructor and CC at yourself your Java file of the code by the midnight of the due date. And, you must name the email subject as: “programming assignment number”, “your class number”. For some reason, if the instructor does not receive your code, you can show the email you sent yourself to prove that you emailed your solution to the instructor on the due date. - You have to turn the hardcopy of your Java file - You must not submit bytecode file (ex: MyProg.class) - Grading of the programming exercise is based on the following: i. The result of the code (80%) - Your code should be compiled and executed on jdk1.4.2_x compiler. I also use jdk1.4.2_x compiler in order to test yours. If you use any other compiler, even if it works in your desktop, it will not work in my desktop. ii. Readability (20%): In the first line of your Java file, you have to put the comments that include your name, date when the file is created, and project description, etc. You should follow the naming convention of the variable, constant, and function for all controls (objects); you should put comment for your function, variable, constant, statement, and the main statements; your email format described in the above. - Late policy: if you submit them late, you will lose 10% out of 100% each late day and after three days, I will not accept them; I don’t accept hardcopy during or after the lecture of due date.