Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a Java program that reads two integer values from the user. The first integer is a value between 1 and 31, inclusive, representing the

image text in transcribed

Write a Java program that reads two integer values from the user. The first integer is a value between 1 and 31, inclusive, representing the number of days in a month. The second integer is a value between 0 and 6, inclusive, indicating the offset value (the number of positions that should be skipped for the first row of output. Your program should use the input values to print a simple grid of numbers corresponding to a typical calendar month (i.e., several rows of up to 7 integers each). You do not need to produce perfect spacing, but each "day" should have at least one space between itself and its neighboring values. For example, given 31 days and an offset of 2, your program would print something like: 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 Alternately, given 28 days and an offset of 6, your program would print: 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2122 23 24 25 26 27 28 Hint: Use a variable that counts up from 1 through the total number of days (including the offset value). Call System.out.println() after every seventh value to begin the next line of the output

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

Professional Microsoft SQL Server 2012 Administration

Authors: Adam Jorgensen, Steven Wort

1st Edition

1118106881, 9781118106884

More Books

Students also viewed these Databases questions

Question

what are the key details from documenting job descriptions

Answered: 1 week ago