Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Integer Patterns: Please write a Java program called PreLab05A that asks the user to enter an integer between 1 and 9 inclusive. Please use a

Integer Patterns:

Please write a Java program called PreLab05A that asks the user to enter an integer between 1 and 9 inclusive. Please use a priming read together with a while loop to test if the entered integer falls outside this range. If so, continue requesting for a valid integer. Once a valid integer has been entered, please use an outer for loop together with another nested inner for loop to print a pattern similar to the sample runs below. You are to calculate the total number of integers written, and the total sum of all the integers written and print these results at the end. Please use descriptive variable names that conform to Java naming conventions.

Please rename your project folder to Your Name PreLab05A and send me your zipped project file as an attachment

run:

Enter an integer between 1 and 9, inclusive:

10

Incorrect. Enter an integer between 1 and 9, inclusive:

0

Incorrect. Enter an integer between 1 and 9, inclusive:

9

1

22

333

4444

55555

666666

7777777

88888888

999999999

The total number of integers written: 45

The total sum of all integers: 285

run:

Enter an integer between 1 and 9, inclusive:

3

1

22

333

The total number of integers written: 6

The total sum of all integers: 14

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

Healthcare And Medical Office Accounting

Authors: Wayne A. Label, Weldon E. Havins

2nd Edition

0986099805, 978-0986099809

Students also viewed these Databases questions