[SOLVED] JAVA - Intro to Java Week 5 Coding Assignment

30.00 $

Programming resource
Digital learning resource
Category:
Practical programming resource
Suitable for guided study and reference
Tutor guidance available when needed

Description

5/5 - (2 votes)

.Coding Steps:

  1. Create an interface named Logger.
  2. Add two void methods to the Logger interface, each should take a String as an argumentLog

b.Error

  1. Create two classes that implement the Logger interface
    1. AsteriskLogger
    2. SpacedLogger
  2. 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.

 

  1. 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:

 

 

Screenshots of Running Application:

 

URL to GitHub Repository:

https://github.com/geraldinedepaul17/Week5 

Resource details

Understand the Task Before You Use the Resource

Review the requirements, identify the programming concepts involved, study the implementation and test your understanding with your own examples and modifications.