This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 ) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class CalculatorRunner | |
{ | |
public static void main(String[] args) | |
{ | |
int num1; | |
int num2; | |
char operator; | |
boolean valid; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Vigenere | |
{ | |
//declare instance variables for text and keyword | |
private String pt = ""; | |
private String key = ""; | |
Vigenere(){ //default constructor | |
pt = ""; | |
key = ""; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
import java.io.*; | |
import java.util.Arrays; | |
public class WordSearchRunner | |
{ | |
public static void main(String[] args) throws FileNotFoundException | |
{ | |
// instantiate Scanner object to read in from file | |
Scanner ws = new Scanner(new File("hidden.txt")); |