[SOLVED] Java Week 5 Assignment

30.00 $

Category:
Click Category Button to View Your Next Assignment | Homework

You will receive the following solution file(s) instantly after successful payment:

zip file icon Week-5-ujwz42.zip (859.7 KB)
Assignment Instructions Updated Recently? Submit Below and we will provide new Solution!
Submit New Instructions
🔒 Securely Powered by:
Secure Checkout
5/5 - (1 vote)

Instructions: In Eclipse, or an IDE of your choice, write the code that accomplishes the objectives listed below. Ensure that the code compiles and runs as directed. Take screenshots of the code and of the running program (make sure to get screenshots of all required functionality) and paste them in this document where instructed below. Create a new repository on GitHub for this week’s assignments and push this document, with your Java project code, to the repository. Add the URL for this week’s repository to this document where instructed and submit this document to your instructor when complete.

Coding Steps:

  1. Create an interface named Logger.
  2. Add two void methods to the Logger interface, each should take a String as an argument
    1. Log
    2. Error
  3. Create two classes that implement the Logger interface
    1. AsteriskLogger
    2. SpacedLogger
  4. The log method on the AsteriskLogger should print out the String it receives between 3 asterisks on either side of the String (e.g. if the String passed in is “Hello”, then it should print ***Hello*** to the console.
  5. The error method on the AsteriskLogger should print the String it receives inside a box of asterisks, with the String preceded by the word “ERROR:”. For example, if “Hello” is the argument, the following should be printed:

 

****************

***Error: Hello***

****************

  1. The SpacedLogger should add spaces between each character of the String argument passed into its methods.
  2. If the log method received “Hello” as an argument, it should print H e l l o
  3. The error method should do the same, but with “ERROR:” preceding the spaced out input (i.e. ERROR: H e l l o)
  4. Create a class named App that has a main method.
  5. In this class instantiate an instance of each of your logger classes that implement the Logger interface.
  6. Test both methods on both instances, passing in Strings of your choice.

Screenshots of Code:

Above is the first version of App I created which moves through the methods linearly, and below is the second version (EnhancedApp) based on user input and choosing to test the methods in any order.

 

 

 

 

 

Screenshots of Running Application:

App Functionality:

EnhancedApp Functionality:

App.java is a rundown of the four methods in order of appearance on these instructions.

EnhancedApp.java is a more dynamic version where the user can select which method they want to test, then enter a test word. The program then outputs that method’s result and then gives the user the option to try any of the 4 methods again up to 5 times.

  • Week-5-ujwz42.zip