Skip to content

Instantly share code, notes, and snippets.

View samnatale3's full-sized avatar
👋

Sam samnatale3

👋
View GitHub Profile
@samnatale3
samnatale3 / ai-skin-assignment.ipynb
Created April 17, 2023 22:29
AI Skin Assignment.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@samnatale3
samnatale3 / Magic8.java
Created June 4, 2020 23:03
Codecademy Challenge - Magic 8 Ball 'Game'
import java.util.Random;
import java.util.ArrayList;
import java.util.Arrays;
public class Magic8{
// Magic 8 Ball usually has a 20 sided dice inside with 10 positive dice sides, 5 negative dice sides and 5 vague responses
// Below defines positive/negative/vague responses
ArrayList<String> positiveResponses = new ArrayList<String> (Arrays.asList("As I see it yes", "It is certain", "It is decidedly so", "Most likely", "Outlook good", "Signs point to yes", "Without a doubt", "You may rely on it", "Yes definitely", "Absolutely"));
@samnatale3
samnatale3 / DNA.java
Created June 4, 2020 22:03
Codecademy Challenge - Program checks if a DNA strand contains a protein
// Program is designed to check if a DNA Sequence is a protein, it does this by checking if it contains ATG, contains TGA at some point after ATG and the characters inbetween are divisible by 3
public class DNA{
public boolean isProtein(String dna){
// The begins and ends variables find the index value of where ATG starts and the index value of where TGA starts + 3 so we get the value of where it ends
int begins = dna.indexOf("ATG");
int ends = (dna.indexOf("TGA")) + 3;
// The string newDna now will hold the new string starting with ATG and ending with TGA cutting out anything before or after in the original string
@samnatale3
samnatale3 / PrimeDirective.java
Last active June 4, 2020 22:04
Codecademy Challenge - Program checks if any of the numbers in an Array are Prime Numbers
import java.util.ArrayList;
class PrimeDirective {
/* This checks if the number is prime by first checking if the number is 0 or less than 0, which makes it not prime.
It then checks if the number is divisible by every number from 3 to itself -1, if it is divisible it sets the return as false as it cannot be a prime number, it it is not the value remains as true */
public boolean isPrime(int num){
boolean value = true;
@samnatale3
samnatale3 / FizzBuzz.java
Last active June 4, 2020 22:04
Codecademy Challenge - FizzBuzz
public class FizzBuzz{
public static void main(String[] args){
for (int i=1; i <= 100; i++){
if (i%3==0 && i%5==0){
System.out.println("FizzBuzz");
} else if (i%3==0){
System.out.println("Fizz");
} else if (i%5==0){
System.out.println("Buzz");
} else{
@samnatale3
samnatale3 / TransitCalculator.java
Last active June 4, 2020 22:05
Codecademy Challenge - Program calculates the cheapest fare option for public transport depending on number of days you are going to use it and number of rides going to be taken
public class TransitCalculator{
//Defining the variables
int numOfDays = 3;
int numOfRides = 34;
// Defining the lists
public static
double[] priceList = {2.75, 33.00, 127.00};
String[] fareOptions = {"Pay-per-ride", "7-day Unlimited Rides", "30-day Unlimited Rides"};