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
''' | |
1. Prompt the user for a number from 1 to 100. Using a while loop, if they entered an invalid number, tell them the number entered is invalid and then prompt them again for a number from 1 to 100. If they enter a valid number - thank them for their input. | |
Prompt the user for a number from 1 to 100 | |
While that number is less than 1 or that number is more than 100 | |
Output that they entered an invalid number | |
Prompt them again for a number from 1 to 100 | |
Output to the user, thanking them for their input | |
''' |
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 NumStatsArray{ | |
//Create a private array as a double as final | |
________________________________________ | |
public NumStatsArray(double[] a){ | |
arr = a; | |
} | |
/* Iterate through and cancatenate all values except last and follow each with a comma. |
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 StringStatsArray{ | |
private final String[] arr; | |
public StringStatsArray(String[] a){ | |
arr = a; | |
} |
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 NumStatsArray{ | |
//Create a private array as a double as final | |
________________________________________ | |
public NumStatsArray(double[] a){ | |
arr = a; | |
} | |
//Iterate through and cancatenate all values except last and follow each with a comma. Creat string with a "{" the beginning and end it with a "}". |
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 Vehicle | |
{ | |
//private integer to store the vehicle's location | |
private int __________; | |
public ________() | |
{ | |
location = ___; | |
} |
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; | |
class StringShortener { | |
public static void main(String[] args) { | |
//Declare scanner | |
Scanner scan = new Scanner(System.in); | |
//Get message from user input | |
System.out.println("Type the message to be shortened"); | |
String msg = scan.nextLine(); |
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
/* | |
(Average an array) Write two overloaded methods that return the average of an | |
array with the following headers: | |
public static int average(int[] array) | |
public static double average(double[] array) | |
Write a test program that prompts the user to enter ten double values, invokes this | |
method, and displays the average value. | |
*/ |
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 dev.theturkey.aoc2020; | |
import java.util.List; | |
public class Day1 extends AOCPuzzle | |
{ | |
public Day1() | |
{ | |
super("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.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(); |