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
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
C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter7: User-defined Simple Data Types, Namespaces, And The String Type
Section: Chapter Questions
Problem 3PE
Related questions
Concept explainers
Types of Loop
Loops are the elements of programming in which a part of code is repeated a particular number of times. Loop executes the series of statements many times till the conditional statement becomes false.
Loops
Any task which is repeated more than one time is called a loop. Basically, loops can be divided into three types as while, do-while and for loop. There are so many programming languages like C, C++, JAVA, PYTHON, and many more where looping statements can be used for repetitive execution.
While Loop
Loop is a feature in the programming language. It helps us to execute a set of instructions regularly. The block of code executes until some conditions provided within that Loop are true.
Question
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps
Knowledge Booster
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.Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning