Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

Java TASK: Write a static method called repeatString that takes as input a String parameter word followed by an int parameter num. It should return

Java TASK: Write a static method called repeatString that takes as input a String parameter word followed by an int parameter num. It should return a String that would be the result of repeating word exactly num times. If num is 0 or negative, the method should output an empty string.

Sample Input 1: Marcia 3 Sample Output 1: MarciaMarciaMarcia Sample Input 2: Marcia 0 Sample Output 2:

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions