DOC PREVIEW
OSU CSE 1223 - PRO10A

This preview shows page 1 out of 3 pages.

Save
View full document
Premium Document
Do you want full access? Go Premium and unlock all 3 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

PROJECT 10a author version 20141010 package project10 import java util Scanner public class project10a public static void main String args private static void resetDice int dice for int i 0 i dice length i dice i 0 private static void rollDice int dice for int i 0 i dice length i if dice i 0 dice i int Math random 6 1 private static String diceToString int dice String res for int i 0 i dice length i res dice i return res private static void promptForReroll int dice Scanner inScanner int roller while true System out println Enter which die should re rolled roller inScanner nextInt if roller 1 return if roller dice length 1 roller 1 System out println Invalid roller index continue dice roller 0 private static boolean promptForPlayAgain Scanner inScanner String response while true System out println Do you want to play again Y N response inScanner next if response equalsIgnoreCase Y return true else if response equalsIgnoreCase N return false else System out println Invalid response try again private static String getResult int dice int counts getCounts dice String resValue for int i 0 i counts length i if counts i 5 resValue Five of a kind else if counts i 4 resValue Four of a kind else if counts i 3 for int j 0 j counts length j if counts j 2 resValue Full House resValue Three of a Kind else if counts i 2 for int j 0 j counts length j if counts j 2 resValue Two Pairs resValue One Pair else resValue Highest Card return resValue private static int getCounts int dice int counts new int 0 String resValue for int i 0 i dice length i if dice i 1 counts 0 else if dice i 2 counts 1 else if dice i 3 counts 2 else if dice i 4 counts 3 else if dice i 5 counts 4 else if dice i 6 counts 5 return counts


View Full Document

OSU CSE 1223 - PRO10A

Documents in this Course
PRO12A

PRO12A

3 pages

PRO11A

PRO11A

4 pages

PRO9A

PRO9A

3 pages

PRO8A

PRO8A

3 pages

PRO7A

PRO7A

2 pages

PRO6A

PRO6A

2 pages

PRO4A

PRO4A

3 pages

PRO3A

PRO3A

3 pages

CL13A

CL13A

2 pages

CL11B

CL11B

2 pages

CL11A

CL11A

2 pages

CL10A

CL10A

2 pages

CL5A

CL5A

2 pages

Load more
Download PRO10A
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view PRO10A and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view PRO10A and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?