Your goal is to upgrade and improve your understanding of Java syntax through practice. To do that, you will also apply and understand object-oriented programming concepts in Java by creating and implementing methods, manipulating objects, and creating program logic according to external requirements in the form of tests.
By doing this assignment you will:
- Create classes and define methods with Java
- Get familiar with string manipulation and regular expressions
- Apply recursive and iterative algorithms to your solution in Java
- Learn how to use getters and setters to access and modify object properties
- Use constructors to initialise objects with default and custom values
- Declare methods and use return values to perform specific tasks in your program
- Utilize loops to iterate over arrays and manipulate array elements
- Understand the difference between primitive and reference Java types
Your task is to implement the Ai
class. This class should not use the default constructor. Ai
must have two properties, both strings: creationDate
and name
. Your custom constructor should set values to those properties. The class also needs to have the necessary getters and setters for both instance variables.
Class Ai
also has to include the following methods:
doubleArray
— takes anint
array as an argument and returns a new array with all values doubledfactorialIterative
— takes anint
as an argument and returns the factorial of that int using an iterative approachfactorialRecursive
— takes anint
as an argument and returns the factorial of that int using a recursive approachpalindromeReplace
— takes aString
as an argument and returns a newString
with all the occurrences of words that are palindromes replaced with the word “palindrome”emailValidator
— takes no arguments and returns a string with a regex expression to validate emails
When you’re finished, you should create a Playground
class. This class should be able to demonstrate the functionality of the Ai
class by instantiating one or more AI objects, invoking its methods, and displaying the results in the console.