There are 3 parts to this question. Please give me the code for all the 3 parts. Any kind of help is appreciated. Thank you.
Assume the only console output method available is display(c), shown below, which you include in your solution.This means you are not permitted to use System.out.print(), System.out.println(), nor System.out.printf() in your methods.
public static void display (char c)
{
System.out.print (c);
}
-Implement the following methods in a program class, that has a main() method to simply test each methods.
-Apply the concept of overloading, where best, and that the methods can call themselves to reduce repeating the same code.
Part 1: Common output methods:
- display (String str) – displays all the characters in the String str
- displayln (String str) – displays all the characters in the String str, following by newline character ('\n')
- display (int val) – displays the integer in variable val
- display (double val) – displays the double in variable val
- displayln () – displays only a newline character
Part 2: Special output methods:
- displayRepeat (String str, int rep) – displays the String str, repeated as many times indicated in variable rep
- displayTriangle(String str)) – displays all the characters in the String str, in a triangle form,
ex: displayTriangle("pies") shows:
p
ii
eee
ssss
Part 3: Include the methods in your own utility class
- name the utility class whatever you want ( Util, Special, or own name, such as: YanniUtil )
- move the methods you wrote into your utility class
- adjust your test program class to call the methods from your utility class