Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVA (Java please, simple program) Write a program using a Scanner that asks the user for a number n between 1 and 9 (inclusive). The

JAVA
image text in transcribed
(Java please, simple program) Write a program using a Scanner that asks the user for a number n between 1 and 9 (inclusive). The program prints a triangle with n rows. The first row contains only the square of 1, and it is right-justified. The second row contains the square of 2 followed by the square of 1, and is right justified. Subsequent rows include the squares of 3, 2, and 1, and then 4, 3, 2 and 1, and so forth until n rows are printed. Assuming the user enters 4, the program prints the following triangle to the console 16 9 9 4 4 1 1 Grading Elements Program asks the user for a number in the specified range Program displays the correct number of rows Program displays the correct number of columns Each column entry contains the appropriate square number Each row is right-justified, with 1 in the right-most column Row spacing is consistent with each column's entry directly below the preceding row Note: If you choose to use a switch statement in your program, you'll have to use break inside the body of the switch. Otherwise, break and continue are completely unnecessary, and are really go-to statements with implicit destinations. Don't use them

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Handbook Of Relational Database Design

Authors: Candace C. Fleming, Barbara Von Halle

1st Edition

0201114348, 978-0201114348

More Books

Students also viewed these Databases questions

Question

LO 14-1 Describe a total product offer.

Answered: 1 week ago

Question

What are the objectives of job evaluation ?

Answered: 1 week ago

Question

Write a note on job design.

Answered: 1 week ago

Question

Compute the derivative of f(x)cos(-4/5x)

Answered: 1 week ago

Question

Discuss the process involved in selection.

Answered: 1 week ago

Question

8-6 Who poses the biggest security threat: insiders or outsiders?

Answered: 1 week ago