diff --git a/Personal/Anagram/AnagramGenerator.java b/Personal/Anagram/AnagramGenerator.java deleted file mode 100644 index d2d5c29..0000000 --- a/Personal/Anagram/AnagramGenerator.java +++ /dev/null @@ -1,46 +0,0 @@ -import java.util.Scanner; -import java.util.ArrayList; -import java.util.Random; - -public class AnagramGenerator { - - static ArrayList getStringList(String userWord) { - /* Return a character list of the string input by the User */ - - // Define fixed length array of the same length as the word - ArrayList charList = new ArrayList<>(); - - // Add each character to the list of characters - for (int i = 0; i < userWord.length(); i++) - charList.add(userWord.charAt(i)); - - return charList; - } - - static String generateAnagram(ArrayList charList) { - /* Returning an Anagram of the word input by the User */ - - StringBuilder stringBuilder = new StringBuilder(); - - while (!charList.isEmpty()) { - int randomIndex = new Random().nextInt(charList.size()); - stringBuilder.append(charList.get(randomIndex)); - charList.remove(charList.get(randomIndex)); - } - return stringBuilder.toString(); - } - - public static void main(String[] args) { - /* Let the user enter in a word and generate an Anagram from it*/ - - Scanner scan = new Scanner(System.in); - System.out.println("Please enter in a word that you would like to see an Anagram of"); - String userWord = scan.next(); - - ArrayList charList = getStringList(userWord); - String finalAnagram = generateAnagram(charList); - - System.out.println("Your Anagram: " + finalAnagram); - scan.close(); - } -} diff --git a/Personal/Interfaces/Animals/Animal.java b/Personal/Interfaces/Animals/Animal.java deleted file mode 100644 index 7ccdbc8..0000000 --- a/Personal/Interfaces/Animals/Animal.java +++ /dev/null @@ -1,7 +0,0 @@ -public interface Animal { - - String animalName(); - String animalSound(); - double animalPrice(); - -} diff --git a/Personal/Interfaces/Animals/Cat.java b/Personal/Interfaces/Animals/Cat.java deleted file mode 100644 index deaa84e..0000000 --- a/Personal/Interfaces/Animals/Cat.java +++ /dev/null @@ -1,18 +0,0 @@ -public class Cat implements Animal { - - @Override - public String animalName() { - return "Cat"; - } - - @Override - public String animalSound() { - return "Meoooww"; - } - - @Override - public double animalPrice() { - return 29.99; - } - -} diff --git a/Personal/Interfaces/Animals/Cow.java b/Personal/Interfaces/Animals/Cow.java deleted file mode 100644 index 7434a55..0000000 --- a/Personal/Interfaces/Animals/Cow.java +++ /dev/null @@ -1,18 +0,0 @@ -public class Cow implements Animal { - - @Override - public String animalName() { - return "Cow"; - } - - @Override - public String animalSound() { - return "Moooo"; - } - - @Override - public double animalPrice() { - return 10.99; - } - -} diff --git a/Personal/Interfaces/Animals/Dog.java b/Personal/Interfaces/Animals/Dog.java deleted file mode 100644 index f881c6f..0000000 --- a/Personal/Interfaces/Animals/Dog.java +++ /dev/null @@ -1,18 +0,0 @@ -public class Dog implements Animal { - - @Override - public String animalName() { - return "Dog"; - } - - @Override - public String animalSound() { - return "Woof Woof"; - } - - @Override - public double animalPrice() { - return 15.99; - } - -} diff --git a/Personal/Interfaces/Animals/Helper.java b/Personal/Interfaces/Animals/Helper.java deleted file mode 100644 index 585ce5e..0000000 --- a/Personal/Interfaces/Animals/Helper.java +++ /dev/null @@ -1,32 +0,0 @@ -public class Helper { - - private final Animal[] animals; - private double averagePrice; - - public Helper(Animal[] animals) { - this.animals = animals; - } - - public void displayInformation() { - - int total = 0; - double sum = 0.0; - for (Animal animal : animals) { - StringBuilder stringBuilder = new StringBuilder(); - - stringBuilder.append("\n\nName: " + animal.animalName()); - stringBuilder.append("\nSound: " + animal.animalSound()); - stringBuilder.append("\nPrice: £" + animal.animalPrice()); - - System.out.println(stringBuilder.toString()); - - total++; - sum += animal.animalPrice(); - } - averagePrice = sum / total; - } - - public void displayAveragePrice() { - System.out.printf("\nThe Average Price For All The Animals Are: £%.2f", averagePrice); - } -} diff --git a/Personal/Interfaces/Animals/Horse.java b/Personal/Interfaces/Animals/Horse.java deleted file mode 100644 index ef94292..0000000 --- a/Personal/Interfaces/Animals/Horse.java +++ /dev/null @@ -1,18 +0,0 @@ -public class Horse implements Animal { - - @Override - public String animalName() { - return "Horse"; - } - - @Override - public String animalSound() { - return "Neighh"; - } - - @Override - public double animalPrice() { - return 59.99; - } - -} \ No newline at end of file diff --git a/Personal/Interfaces/Animals/Main.java b/Personal/Interfaces/Animals/Main.java deleted file mode 100644 index 9dc494c..0000000 --- a/Personal/Interfaces/Animals/Main.java +++ /dev/null @@ -1,17 +0,0 @@ -public class Main { - public static void main(String[] args) { - displayAnimals(); - } - - private static void displayAnimals() { - Helper helper = new Helper(new Animal[] { - new Cow(), - new Cat(), - new Dog(), - new Horse() - }); - - helper.displayInformation(); - helper.displayAveragePrice(); - } -}