I hereby claim:
- I am christopherturner on github.
- I am cmt (https://keybase.io/cmt) on keybase.
- I have a public key whose fingerprint is 3746 2B06 9578 E303 56B3 D887 C788 604F 98D8 1C0A
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
// Written by Christopher Turner. | |
import java.util.*; | |
public class SearchAlgs { | |
public static int getMin(int[] a) { //Finds the minimum value in an array of integers | |
int min = 0; //Initializes to 0 | |
for (int i : a) { //For every item in the array... | |
if (i < min) { //If the minimum variable is greater than the current element | |
min = i; //Set the minimum variable equal to the current element |
import java.util.*; //Imports | |
public class NthRoot { | |
public static void main(String[] args) { | |
Calculator rootFinder = new Calculator(); //Creates a new calculator object from the class (simply for modularizing my code) | |
double radical = (double) rootFinder.getRadical(); //Gets the number x that you want to find the nth root of | |
int n = rootFinder.getN(); //Gets the number n to find the nth root of "radical" | |
int requestedError = rootFinder.getRequestedError(); //Gets the integer P to find the error tolerated in the form 10E-P | |
double xtoN = radical; //Creates a variable for the final result, initially setting it equal to the input | |
double calculatedError = Math.pow(10, -(requestedError)); //Inserts the requestedError as the exponent P in 10E-P, to calculate the threshold where an answer over is wrong but an answer under is correct | |
while (Math.abs(radical - Math.pow(xtoN,n)) > calculatedError) { //Runs while the difference between the inital input and the |
// Written by Christopher Turner.- | |
import java.util.*; | |
public class NthRoot { | |
public static void main(String[] args) { | |
Calculator rootFinder = new Calculator(); | |
double radical = (double) rootFinder.getRadical(); | |
int n = rootFinder.getN(); | |
int requestedError = rootFinder.getRequestedError(); | |
double xtoN = radical; //Creates a variable for the final result, initially setting it equal to the input | |
double calculatedError = Math.pow(10, -(requestedError)); //Applies the base to the variable exponent to get the maximum allowed degree error |
for (Player p: players) { | |
p.receiveCard(gameDeck.drawCard()); | |
} |
public class Card { | |
//Here you need to declare the instance variables for the Card object | |
private final int suit; | |
private final int rank; | |
// Kinds of ranks | |
public final static int ACE = 1; | |
public final static int DEUCE = 2; | |
public final static int THREE = 3; | |
public final static int FOUR = 4; | |
public final static int FIVE = 5; |
while (myShip.alreadyGuessed.size() < 3) {
You'll also need to update other parts of the program that use numOfHits so that the program will work as expected.numOfGuesses
and your method getNumOfGuesses()
).userGuess
at one point in the program, while calling it theGuess
later on. Make sure you're consistent and only use a single variable for the user's guess.