Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

this needs to be done in java... Two lines of code need to be inserted at the beginning of this main method that need to

this needs to be done in java... Two lines of code need to be inserted at the beginning of this main method that need to reside inside MyLoggerTest class. Your job is to write MyLogger class and complete the set of print/println statements within MyLoggerTest main method to cover all print/println methods that have void as their return value. There should be 9 distinct print/println methods in total that need to be tested within your main method. I will give you the initial version of MyLoggerTest class. You need to complete it to cover all desired method tested. As well, you need to write MyLogger class. -You need to override all void print/println to add to their output the line requested For example, what needs to be added to the regular output is the following: Sun, July 1, 2018 at 17:04:02:003 EDT: printing a float:

- In order to do this, you need to find out the class these print/println reside in, subclass it, and override the set of 9 methods requested

- In the MyLoggerTest class, you need to use the System.setOut method given code: image text in transcribed

public class MyLoggerTest { public static void main(String[] args) { // Initialize MyLogger class appropriately (one line of code) // Use System.setOut method to set your output stream appropriately (one line of code) float f = 45.4f; System.out.println(f); System.out.println("My name is Michel"); // ... /* * I need to be able to call any of the print/println methods that are invoked through System.out. * The list is: * void print/println(boolean b) void print/println(char c) void print/println(char[] s) void print/println(double d) void print/println(float f) void print/println(int i) void print/println(long l) void print/println(Object obj) void print/println(String s) * and I would expect for any of the print/println methods listed above, the output be as follows: *  :  :  * Example as output for the code above: * Sun, July 1, 2018 at 17:04:02:003 EDT: printing a float: 45.4 * Sun, July 1, 2018 at 17:04:02:003 EDT: printing a String: My Name is Michel * * I should be able to test your code by calling print or println methods using System.out. */ } }

The purpose of this assignment is to enrich your logging system by adding more details to the displayed messages and especially the timestamp, with milliseconds, so you can read the logs in chronological order, for debugging and verification purposes. No need to override toString nor to do anything with toString method. What I need to run, is the following statements (within a main method inside MyLoggerTest.java) // two lines of code here need to be added System.out.println("My Name is Michel"); int x = 7; System.out.println(x): /I.. invoking more print or println methods that take other types of parameters And the output I need to see is the following Sun, July 1, 2018 at 17:04:02:003 EDT printing an integer: 15 Sun, July 1, 2018 at 17:04:02:003 EDT printing a boolean: true Sun, July 1, 2018 at 17:04:02:003 EDT printing a character: c Sun, July 1, 2018 at 17:04:02:003 EDT: printing an array of characters: abcde Sun, July 1, 2018 at 17:04:02:003 EDT printing a double: 34.5 Sun, July 1, 2018 at 17:04:02:003 EDT: printing a float: 45.4 Sun, July 1, 2018 at 17:04:02:003 EDT printing a long: 12345678 Sun, July 1, 2018 at 17:04:02:003 EDT printing a String: MyLogger@6bc7c054 Sun, July 1, 2018 at 17:04:02:003 EDT printing a String: My Name is Michel Two lines of code need to be inserted at the beginning of this main method that need to reside inside MyLoggerTest class. Your job is to write MyLogger class and complete the set of print/println statements within MyLoggerTest main method to cover all print/println methods that have void as their return value. There should be 9 distinct print/println methods in total that need to be tested within your main method. I will give you the initial version of MyLoggerTest class. You need to complete it to cover all desired method tested. As well, you need to write MyLogger class

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Expert Oracle9i Database Administration

Authors: Sam R. Alapati

1st Edition

1590590228, 978-1590590225

More Books

Students also viewed these Databases questions

Question

What are the steps in negotiations?

Answered: 1 week ago

Question

Discuss all branches of science

Answered: 1 week ago

Question

Question What are the requirements for a SIMPLE 401(k) plan?

Answered: 1 week ago