Menu
support@nursinghomework.org
+1 714-215-3097

(Solved) : Write Java Program Uses Recursion Throughout Following Sequence Creates Queue Strings Ente Q35594100

Write a Java program that uses recursionthroughout to do the following in sequence:

  • creates a queue of strings
    • enter a set number of strings at the keyboard or
    • get the strings from an input file¬†¬†
  • displays the original contents of the queue
  • reverses the contents of the queue
  • displays the contents of the queue in reverse

Here’s a program run of a program where recursion was used to doeach of the above tasks:

Create a queue:

How many names?

6 Enter a name

Joe

Enter a name

Jess Enter a name

Jim Enter a name

Jill Enter a name

Jane Enter a name

Jerry

Original contents of the queue:

Joe Jess Jim Jill Jane Jerry

Contents of the queue in reverse:

Jerry Jane Jill Jim Jess Joe

Create a queue:

How many names?

10

Enter a name

Jane

Enter a name

Jack

Enter a name

Jill

Enter a name

Joseph

Enter a name

Janna

Enter a name

John Enter a name

Jenny

Enter a name

Jacob Enter a name

Jennifer

Enter a name

Jonathan

Original contents of the queue:

Jane Jack Jill Joseph Janna John Jenny Jacob Jennifer Jonathan=====================================================================

Contents of the queue in reverse: Jonathan Jennifer Jacob JennyJohn Janna Joseph Jill Jack Jane

=======================

Leave a Reply

Your email address will not be published. Required fields are marked *