Write a program that prompts the user to enter a positive integer value and displays a...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a program that prompts the user to enter a positive integer value and displays a pattern based on the entered value. Sample Outputs: Enter a positive integer (-1 to end): -3 You entered a wrong value!!! Enter a positive integer (-1 to end): 3 Enter a positive integer (-1 to end): 5 ** *** **** Enter a positive integer (-1 to end): 6 ** *** **** ***** Enter a positive integer (-1 to end): -2 You entered a wrong value!!! Enter a positive integer (-1 to end): 2 Enter a positive integer (-1 to end): 1 * Enter a positive integer (-1 to end): 0 You entered a wrong value!!! Enter a positive integer (-1 to end): -1 You have terminated the program!!! Write a program that prompts the user to enter a positive integer value and displays a pattern based on the entered value. Sample Outputs: Enter a positive integer (-1 to end): -3 You entered a wrong value!!! Enter a positive integer (-1 to end): 3 Enter a positive integer (-1 to end): 5 ** *** **** Enter a positive integer (-1 to end): 6 ** *** **** ***** Enter a positive integer (-1 to end): -2 You entered a wrong value!!! Enter a positive integer (-1 to end): 2 Enter a positive integer (-1 to end): 1 * Enter a positive integer (-1 to end): 0 You entered a wrong value!!! Enter a positive integer (-1 to end): -1 You have terminated the program!!!
Expert Answer:
Related Book For
Introduction to Java Programming, Comprehensive Version
ISBN: 978-0133761313
10th Edition
Authors: Y. Daniel Liang
Posted Date:
Students also viewed these programming questions
-
You are required to write a Python program that will manage character (heroes and villain) information. Character (hero and villain) information will be stored in a text file that will be read in...
-
A sphere of 80 mm diameter lies at a depth of 500 m in sea water. The bulk modulus of sphere is 200 GPa. If the specific weight of sea water is 10.3 kN/m, the decrease in the volume (in mm) of the...
-
Sketch a graph of the function and determine whether it is even, odd, or neither. Verify your answer algebraically. 1. f(x) = 9 2. f(x) = 5 3x 3. f(x) = |x - 5| 4. h(x) = x2 - 4
-
Consider the two parallel, coaxial, ring-shaped disks shown schematically. Show that Fiz can be expressed as where all view factors on the right-hand side of the equation can be evaluated from Figure...
-
You push a \(30 \mathrm{~kg}\) shopping cart initially at rest (loaded with groceries) with a constant \(12-\mathrm{N}\) force. How far does it travel after pushing it for \(4.5 \mathrm{~s}\) ?
-
Montana Company produces basketballs. It incurred the following costs during the year. Direct materials ........... $14,490 Direct labor .............. $25,530 Fixed manufacturing overhead ........
-
11. If dy + 2y tan x = sin x, 0
-
2 PA3: Truth tables and equivalence 3 4 5 For PA3 you will be provided with a function call f2(f,p,q) 6 which will cal f(p,q), and with a main to test your code. 7 You will implement two functions:...
-
Credit memos are created when a product is returned. Credit memos reduce A/R (accounts receivable) by crediting the account, and it writes off the invoice. This also records a debit to the Sales...
-
Rylee inherited a 145-acre ranch. She decided to quit her job and continue the existing cattle operation. Her previous salary was $70,000 a year. When she sold the calves, she earned $1550 per head...
-
Regarding the Rational Method, select the correct statement: The frequency of occurrence for the peak discharge is usually lower than the frequency of the rainfall producing that event. In the...
-
According to the IS Budget Capability Maturity Framework, most companies are at what is the level(s) of maturity?
-
John is a single individual who claims the standard deduction. During 2023, he receives $ 11 comma 000 of wages and $ 800 of dividends. Compute John's taxable income assuming.
-
A company, what operated profitably during its first five years, sustained a loss in the sixth year which equaled its pretax income of any four of the first 5 years of its operations. The company can...
-
Beta is the slope of the best fit line for the points with coordinates representing the and the for each one of several years. OA. rate of inflation, rate of return for an individual security OB....
-
Name some of the various types of financial intermediaries described in the chapter and indicate the primary reason(s) each was created.
-
The program in Listing 3.1, AdditionQuiz.java, generates two integers and prompts the user to enter the sum of these two integers. Revise the program to generate three single-digit integers and...
-
Postfix notation is a way of writing expressions without using parentheses. For example, the expression (1 + 2) * 3 would be written as 1 2 + 3 *. A postfix expression is evaluated using a stack....
-
Write a program that displays two circles with radius 10 at location (40, 40) and (120, 150) with a line connecting the two circles, as shown in Figure 15.28b. The distance between the circles is...
-
James Halperin, co-chair of Heritage Auctions, was interviewed about his experiences auctioning rare coins. Noting that when the auction house first opened in the 1970s, I used to proofread every...
-
An opinion column in the Wall Street Journal argued that Americans enjoy comparative advantages in [service] sectors such as construction and engineering, but global trade in services is weighed down...
-
Catherine Rampell is an economics writer for the Washington Post. In an article in 2023, she observes that the average U.S. tariff rate on mens underwear is 11.5 percent. The average rate on womens...
Study smarter with the SolutionInn App