DOC PREVIEW
OSU CSE 1223 - PRO7A

This preview shows page 1 out of 2 pages.

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

Unformatted text preview:

project07a For this lab you will write a Java program that plays the dice game High Low author version 20140923 package project07 import java util Scanner public class project07a public static void main String args int amount 100 roll1 roll2 int bet char c int lost or win Scanner in new Scanner System in do if amount 0 amount 0 break System out println You have amount dollars bet getBet in amount if bet 0 break c getHighLow in roll1 getRoll System out println Die 1 rolls roll1 roll2 getRoll System out println Die 2 rolls roll2 System out println Total of two dice is roll1 roll2 lost or win determineWinnings c bet roll1 roll2 if lost or win 0 System out println You lost else System out println You won lost or win dollars amount amount lost or win System out println System out println while true private static int getBet Scanner inScanner int currentPool System out println Enter an amount to bet 0 to quit int result inScanner nextInt if result currentPool do System out println u dont have result to bet System out println Enter an amount to bet 0 to quit result inScanner nextInt while result currentPool return result private static char getHighLow Scanner inScanner System out println High low or sevens H L S String str inScanner next return str charAt 0 private static int getRoll return int Math random 6 1 private static int determineWinnings char highLow int bet int roll int result 0 if highLow H if roll 7 result 1 bet else result bet if highLow L if roll 7 result 1 bet else result bet if highLow S if roll 7 result 4 bet else result 1 bet return result


View Full Document

OSU CSE 1223 - PRO7A

Documents in this Course
PRO12A

PRO12A

3 pages

PRO11A

PRO11A

4 pages

PRO10A

PRO10A

3 pages

PRO9A

PRO9A

3 pages

PRO8A

PRO8A

3 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 PRO7A
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 PRO7A 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 PRO7A 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?