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