Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Lab Goal : The lab was designed to teach you more about parameters. Lab Description : Take a word and a number of times to

Lab Goal : The lab was designed to teach you more about parameters. Lab Description : Take a word and a number of times to display that word. Then, write a method that takes in the word and times to display as parameters and displays the word that number of times. Sample Input : hello 9 funny 6 chicken 4 Sample Output : Enter the word to display :: hello Enter the times to display :: 9 hello hello hello hello hello hello hello hello hello

Enter the word to display :: funny Enter the times to display :: 6 funny funny funny funny funny funny

Enter the word to display :: chicken Enter the times to display :: 4 chicken chicken chicken chicken

//Name - //Date - //Lab - import java.util.*; import static java.lang.System.*; public class lab08a { public static void main( String args[] ) { for (int x = 1; x <=3; x++) //loop used so that you can enter 3 values { //ask the user to enter a word and the number of times they would like it to be printed //instantiate a WordPrinter object //call the printWord method by passing the word and the number of times } out.println ("program completed by: your name here"); } }

//Name - //Date - //Lab - import java.util.*; import static java.lang.System.*; class WordPrinter { public WordPrinter() { //nothing needed here because there are no instance variables } public void printWord(String w, int n) { //write a for-loop here to print 'w' 'n' times } }

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

Graph Database Modeling With Neo4j

Authors: Ajit Singh

2nd Edition

B0BDWT2XLR, 979-8351798783

More Books

Students also viewed these Databases questions