Problem: Today you are to write a Java program that will prompt for and read 1 word of a length greater that 3 entered by the user, which you store in a String variable. With the use of loops and nested loops you are to produce a specific triangular pattern with the characters of the word without the first and last characters and having: & next to each character as illustrated in the figures below, exactly as displayed in the samples below. Your code must work no matter what word the user enters. You can use the appropriate combination of loops and nested loops to solve the problem. You are not allowed to use arrays. Based on the previous specifications your program should behave and look exactly as shown in the cases below. Your program should work for any word entered by the user, not just the ones in the samples. Note that in the output: • is a space, → is a tab and J is a new line. All words except for user input (in bleu) must be exactly as indicated in the sample outputs. Any extra "spaces" and/or "new lines" will be graded a wrong answer. Program Sample outputs Enter-a word: Roman. o&>m&>a&→. m&>a&>J a&>J Pretty triangle! Enter-a word:9876543.J 8&>78>6&→5&→4&J 78>6&>5&→4&J 6&→5&→4&J 5&→4&J Prettyotriangle! Enter-a word: mOntreAlJ 0&>n&>t&>r&→e&→A&→J n&>t&>r&>e&→A&→J t&>r&>e&>A&→J r&→e&→A&> e&>A&>J A&→J

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
Problem: Today you are to write a Java program that will prompt for and read 1 word of a length greater that 3 entered by
the user, which you store in a String variable. With the use of loops and nested loops you are to produce a specific triangular
pattern with the characters of the word without the first and last characters and having: & next to each character as
illustrated in the figures below, exactly as displayed in the samples below. Your code must work no matter what word the
user enters.
You can use the appropriate combination of loops and nested loops to solve the problem. You are not allowed to use arrays.
Based on the previous specifications your program should behave and look exactly as shown in the cases below. Your
program should work for any word entered by the user, not just the ones in the samples.
Note that in the output: • is a space, → is a tab and J is a new line. All words except for user input (in bleu) must be exactly
as indicated in the sample outputs. Any extra "spaces" and/or "new lines" will be graded a wrong answer.
Program Sample outputs
Enter-a word: Roman.
o&>m&>a&→.
m&>a&>J
a&>J
Pretty triangle!
Enter-a word:9876543.J
8&>78>6&→5&→4&J
78>6&>5&→4&J
6&→5&→4&J
5&→4&J
Prettyotriangle!
Enter-a word: mOntreAlJ
0&>n&>t&>r&→e&→A&→J
n&>t&>r&>e&→A&→J
t&>r&>e&>A&→J
r&>e&>A&>.
e&>A&>J
A&>J
Pretty triangle!
Note 1: You are to expect a perfect user who will always enter a word of a length greater than 3 (with no whitespace
characters); hence do not verify the validity of user input.
Note 2: The use of libraries other than java.util.Scanner is prohibited. Your program must work for any strings entered, not
just the ones in the samples above.
Note 3: Final thought, remember that your solution is case-sensitive and space-sensitive and fulfill the above instructions
carefully and precisely.
Transcribed Image Text:Problem: Today you are to write a Java program that will prompt for and read 1 word of a length greater that 3 entered by the user, which you store in a String variable. With the use of loops and nested loops you are to produce a specific triangular pattern with the characters of the word without the first and last characters and having: & next to each character as illustrated in the figures below, exactly as displayed in the samples below. Your code must work no matter what word the user enters. You can use the appropriate combination of loops and nested loops to solve the problem. You are not allowed to use arrays. Based on the previous specifications your program should behave and look exactly as shown in the cases below. Your program should work for any word entered by the user, not just the ones in the samples. Note that in the output: • is a space, → is a tab and J is a new line. All words except for user input (in bleu) must be exactly as indicated in the sample outputs. Any extra "spaces" and/or "new lines" will be graded a wrong answer. Program Sample outputs Enter-a word: Roman. o&>m&>a&→. m&>a&>J a&>J Pretty triangle! Enter-a word:9876543.J 8&>78>6&→5&→4&J 78>6&>5&→4&J 6&→5&→4&J 5&→4&J Prettyotriangle! Enter-a word: mOntreAlJ 0&>n&>t&>r&→e&→A&→J n&>t&>r&>e&→A&→J t&>r&>e&>A&→J r&>e&>A&>. e&>A&>J A&>J Pretty triangle! Note 1: You are to expect a perfect user who will always enter a word of a length greater than 3 (with no whitespace characters); hence do not verify the validity of user input. Note 2: The use of libraries other than java.util.Scanner is prohibited. Your program must work for any strings entered, not just the ones in the samples above. Note 3: Final thought, remember that your solution is case-sensitive and space-sensitive and fulfill the above instructions carefully and precisely.
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Types of Loop
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education