Skip to content

Instantly share code, notes, and snippets.

Ben Bailey benfb

Block or report user

Report or block benfb

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View WordSearch.java
import java.util.Arrays;
public class WordSearch
{
/** 2D array instance variable*/
private String[][] grid;
/** constructor used to set the number of rows and columns in the 2D array
* @param row
* @param col*/
View VigenereRunner.java
import java.util.Scanner;
public class VigenereRunner
{
public static void main(String[] args)
{
//instantiate a Scanner object
Scanner scan = new Scanner(System.in);
//prompt the user for the text to encrypt
View Vigenere.java
public class Vigenere
{
//declare instance variables for text and keyword
private String pt = "";
private String key = "";
Vigenere(){ //default constructor
pt = "";
key = "";
}
View AliceCount.java
// add import statements
import java.util.*;
import java.io.*; //imports the io library. Note: Importing java.* does NOT work
// create class AliceCount
public class AliceCount
{
// create main method - remember to catch the exception
public static void main(String[] args)
View GCDRunner.java
//import Scanner
import java.util.Scanner; //imports only scanner
public class GCDRunner
{
//main method
public static void main(String[] args)
{
//instantiate Scanner object
Scanner scan = new Scanner(System.in);
View gcd.java
public class GCD
{
//instance variables - DO NOT ADD ANY MORE INSTANCE VARIABLES
private int numerator;
private int denominator;
//default constructor
public GCD()
{
numerator = 0; //initiates numerator variable
View Calculator.java
//I accidentally switched up operand and operator, but the program has the same effect
public class Calculator
{
//instance variables
private double num1;
private double num2;
private char operand;
//default constructor
public Calculator()
View CalculatorRunner.java
import java.util.Scanner;
public class CalculatorRunner
{
public static void main(String[] args)
{
int num1;
int num2;
char operator;
boolean valid;
View InOrderRunner.java
// name:
// purpose: determine whether three input values are in order: x <= y <= z
import java.util.*; //for our purposes, imports scanner
public class InOrderRunner //creates the InOrderRunner class
{
// main(): program starting point
public static void main( String[] args )
{
View InOrder.java
public class InOrder //creates the InOrder class
{
private int numOne; //creates the instance variable numOne
private int numTwo; //creates the instance variable numTwo
private int numThree; //creates the instance variable numThree
boolean b = false; //creates the boolean value b (not instance)
public InOrder() //default constructor
{ //assigns default values to instance variables
numOne = 0;
You can’t perform that action at this time.