008-005-006
Reference Type Parameter Method: String Decorator
Easy
Problem Description
Reference Type Parameter method: String Decorator
In this problem, you will create a program that defines a decorate method accepting a String parameter and displays the string with "★" decorations added before and after, to standard output.
Learning Objective: Define methods with reference type parameters
Define a decorate method that accepts a String parameter. Inside the method, print the received string prefixed with "★ " and suffixed with " ★". In main, read a string from standard input and pass it to the decorate method.
Input
Line 1: String
Output
★ [string] ★
Ready to Try Running Code?
Log in to access the code editor and execute your solutions for this problem.
Don't have an account?
Sign Up