Waiting for answer This question has not been answered yet. You can hire a professional tutor to get the answer.

QUESTION

Write a function called centerString with the following signature (parameters) fun centerString( str : String, columnWidth : Int = 80, padChar : String = " " ) :String { } This function should take th

Write a function called centerString with the following signature (parameters)

fun centerString( str : String, columnWidth : Int = 80, padChar : String = " " ) :String {

}

This function should take the string and center it inside another string of size "columnWidth" with padChar characters on either side of the string that is passed in.  Use some simple calculations to determine where the string is supposed to start in the larger columnWidth string.  This function should not print anything but return the string centered and padded appropriately.

The columnWidth should have a default parameter of 80 and the padChar should have a default of a single space string.

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question