Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Leon Hunter authored and Leon Hunter committed Feb 21, 2019
1 parent 760ceda commit 3ce85a1
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 6 deletions.
14 changes: 9 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,29 @@
* To create a casino simulation.

## Minimum Viable Product (MVP)
* Your application must have at the very least 3 games:
* Your application must have at the very least 4 games:
* Go Fish a card game
* BlackJack a card game
* Craps a dice game
* An additional dice game

## Specs
* The project should include some concept of
* `Player` class
* `Player` objects should be created upon input from a user.
* `Game` interface
* Contract which ensures that a class enforces some aspect of _playing_.
* `Gamble` interface
* Contract which ensures that a class enforces some aspect of _waging money_.
* `GamblingGame` interface
* Contract which ensures that a game enforces some aspect of _waging money_.
* `GamblingPlayer` interface
* Contract which ensures that a player has some ability to _wage money_.
* The `utilities.Console` class should NOT be modified. It should be _wrapped_ or encapsulated by other classes.



## Developmental Notes
* Go fish is a friendly game and should not involve gambling.
* `BlackJack` and `GoFish` are both Card Games and should therefore inherit from a common `CardGame`.
* `GoFish` is a friendly game and should not involve gambling.
* `BlackJack` and `GoFish` are both card games and should therefore inherit from a common `CardGame`.
* Any common logic or fields between the games should live CardGame class, **not** BlackJack **nor** GoFish.
* You must have a completed and approved UML diagram before you proceed to do any development
* All public methods should be tested.
2 changes: 1 addition & 1 deletion src/main/java/io/zipcoder/casino/Casino.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@

public class Casino {
public static void main(String[] args) {

// write your tests before you start fucking with this
}
}
61 changes: 61 additions & 0 deletions src/main/java/io/zipcoder/casino/utilities/Console.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
package io.zipcoder.casino.utilities;


import java.io.InputStream;
import java.io.PrintStream;
import java.util.Scanner;

/**
* You are advised against modifying this class.
*/
public final class Console {
private final Scanner input;
private final PrintStream output;

public Console(InputStream in, PrintStream out) {
this.input = new Scanner(in);
this.output = out;
}

public void print(String val, Object... args) {
output.format(val, args);
}

public void println(String val, Object... vals) {
print(val + "\n", vals);
}

public String getStringInput(String prompt, Object... args) {
println(prompt, args);
return input.nextLine();
}

public Double getDoubleInput(String prompt, Object... args) {
String stringInput = getStringInput(prompt, args);
try {
Double doubleInput = Double.parseDouble(stringInput);
return doubleInput;
} catch (NumberFormatException nfe) { // TODO - Eliminate recursive nature
println("[ %s ] is an invalid user input!", stringInput);
println("Try inputting a numeric value!");
return getDoubleInput(prompt, args);
}
}

public Long getLongInput(String prompt, Object... args) {
String stringInput = getStringInput(prompt, args);
try {
Long longInput = Long.parseLong(stringInput);
return longInput;
} catch (NumberFormatException nfe) { // TODO - Eliminate recursive nature
println("[ %s ] is an invalid user input!", stringInput);
println("Try inputting an integer value!");
return getLongInput(prompt, args);
}
}

public Integer getIntegerInput(String prompt, Object... args) {
return getLongInput(prompt, args).intValue();
}
}

0 comments on commit 3ce85a1

Please sign in to comment.