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.io.BufferedReader; | |
import java.io.File; | |
import java.io.FileNotFoundException; | |
import java.io.FileReader; | |
import java.io.IOException; | |
import java.util.ArrayList; | |
import java.util.List; | |
public abstract class AOCPuzzle | |
{ |
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 AoC2020Core | |
{ | |
public static void main(String[] args) | |
{ | |
//new Day1(); | |
//new Day2(); | |
//new Day3(); | |
//new Day4(); | |
//new Day5(); |
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
package edhesive.assignment2; | |
public class Airplane{ | |
private double distance; | |
private int direction; | |
private int altitude; | |
private String callSign; | |
public Airplane(String cs, double dist, int dir, int alt){ | |
distance = Math.abs(dist); |
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
/* Assignment 2 - Control Tower */ | |
/* Class name - must be "Assignment2" in order to run*/ | |
import java.util.Scanner; | |
//import edhesive.assignment2.Airplane; | |
public class Assignment2 | |
{ | |
public static void main(String[] args) | |
{ | |
// Create Scanner and Airplane 1 |
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.*; | |
public class SportsEvent | |
{ | |
// instance variables | |
private double[] scores = new double[8]; | |
private Scanner keyboard = new Scanner(System.in); | |
/* This method prompts the user to enter in 8 scores and stores | |
* them in the array scores. |
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 ChanceAtWinningGraps_06_32 { | |
public static void main(String[] args) { | |
int winCount = __; | |
for (int i = ___; i < 10000; i++) { | |
int dice = _________(); | |
if (dice == ____ || dice == ___) { | |
_________________++; | |
} | |
else if (dice == 2 || dice == 3 || dice == 12) { |
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
/**Game: craps) Craps is a popular dice game played in casinos. | |
*Write a program to play a variation of the game, as follows:Roll two dice. | |
*Each die has six faces representing values 1, 2, ..., and 6, respec-tively. | |
*Check the sum of the two dice. If the sum is 2, 3, or 12 (called craps), | |
*you lose; if the sum is 7 or 11 (called natural), you win; if the sum is | |
*another value (i.e., 4, 5, 6, 8, 9, or 10), a point is established. | |
*Continue to roll the dice until either a 7 or the same point value is rolled. | |
*If 7 is rolled, you lose. Otherwise, you win.Your program acts as a single player | |
*See page 222 in the Liang textbook for more information. | |
*/ |
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
/** | |
*(Conversions between Celsius and Fahrenheit) Write a class that | |
*contains the fol-lowing two methods: | |
*Convert from Celsius to Fahrenheit | |
*public static double celsiusToFahrenheit(double celsius) | |
*Convert from Fahrenheit to Celsius | |
*public static double fahrenheitToCelsius(double fahrenheit) | |
*The formula for the conversion is: | |
*fahrenheit = (9.0 / 5) * celsius + 32 | |
*celsius = (5.0 / 9) * (fahrenheit – 32) |
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
/** | |
*(Conversions between Celsius and Fahrenheit) Write a class that contains | |
*the fol-lowing two methods:/** Convert from Celsius to Fahrenheit | |
*/public static double celsiusToFahrenheit(double celsius)/** | |
*Convert from Fahrenheit to Celsius | |
*/public static double fahrenheitToCelsius(double fahrenheit) | |
*The formula for the conversion is: | |
*fahrenheit = (9.0 / 5) | |
* celsius + 32celsius = (5.0 / 9) * (fahrenheit – 32) | |
*Write a test program that invokes these methods to display the following tables |
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
/** | |
*(Display patterns) Write a method to display a pattern as follows: | |
*1 | |
*2 1 | |
*3 2 1 | |
*... | |
*n n-1 ... 3 2 1 | |
*The method header is | |
*public static void displayPattern(int n) | |
*/ |