17.Write a Java program that prompts the user to input an integer greater than 0 which represents the size/height of the triangle shape. The program should print the following triangle shape according to the user input by alternating 'l' and '+' characters. Invalid error message must be displayed if the size is less than 1. Example: if the size of the shape = 4, then the program should output: 1 1+1 1+1+1 1+1+1+1

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter2: Using Data
Section: Chapter Questions
Problem 14PE
icon
Related questions
Question
17.Write a Java program that prompts the user to input an integer greater than 0 which represents the size/height of the
triangle shape. The program should print the following triangle shape according to the user input by alternating 'f' and
'+' characters. Invalid error message must be displayed if the size is less than 1.
Example: if the size of the shape = 4, then the p program
should output:
!
!+!
!+!+!
1+1+1+1
Transcribed Image Text:17.Write a Java program that prompts the user to input an integer greater than 0 which represents the size/height of the triangle shape. The program should print the following triangle shape according to the user input by alternating 'f' and '+' characters. Invalid error message must be displayed if the size is less than 1. Example: if the size of the shape = 4, then the p program should output: ! !+! !+!+! 1+1+1+1
Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Mathematical functions
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
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT