Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

using for loop Write a complete Java program that starts by declaring four integer constants, and one boolean constant, with the following initial values: final

using for loop
Write a complete Java program that starts by declaring four integer constants, and one boolean constant, with the following initial values:
final int START =;
final int END =10752;
final int INCREMENT =256;
final int COLUMNS =8;
final boolean RIGHT_JUSTIFY = true;
The program should print the numbers between START and END (inclusive), counting up by INCREMENT, in COLUMNS neatly-aligned columns of width 6 characters. The numbers in each column would either be left or right justified depending on RIGHT_JUSTIFY. The values above should produce output like this:
\table[[0,256,512,768,1024,1280,1536,1792],[2048,2304,2560,2816,3072,3328,3584,3840],[4096,4352,4608,4864,5120,5376,5632,5888],[6144,6400,6656,6912,7168,7424,7680,7936],[8192,8448,8704,8960,9216,9472,9728,9984],[10240,10496,10752,,,,,],[*** End of program. ***,,,,,,,]]
If RIGHT_JUSTIFY was false it would produce this:
\table[[0,256,512,768,1024,1280,1536,1792],[2048,2304,2560,2816,3072,3328,3584,3840],[4096,4352,4608,4864,5120,5376,5632,5888],[6144,6400,6656,6912,7168,7424,7680,7936],[8192,8448,8704,8960,9216,9472,9728,9984],[10240,10496,10752,,,,,]]
image text in transcribed

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

Database And Expert Systems Applications 19th International Conference Dexa 2008 Turin Italy September 2008 Proceedings Lncs 5181

Authors: Sourav S. Bhowmick ,Josef Kung ,Roland Wagner

2008th Edition

3540856536, 978-3540856535

More Books

Students also viewed these Databases questions

Question

What is the preferred personality?

Answered: 1 week ago