QuestionQuestion

1. Write a Java program to create the following grid of numbers, using for statements:
1 2 3 4 5
2 3 4 5 6
3 4 5 6 7
4 5 6 7 8
5 6 7 8 9

2. Use nested for loops statements to generate the following output.
Sample output:
Do you want to start(Y/N): y
Enter an integer (1 - 9) 12
ERROR! Should be positive. REENTER: 4
1
22
333
4444
Do you want to continue(Y/N): y
Enter an integer (1 - 9) 6
1
22
333
4444
55555
666666
Do you want to continue(Y/N): y
Enter an integer (1 - 9) 3
1
22
333
Do you want to continue(Y/N): n

3. Write a Java program that prompts for integers and displays them in binary.
Sample output:
Do you want to start(Y/N): y
Enter an integer and I will convert it to binary code: 16
You entered 16.
16 in binary is 10000.
Do you want to continue(Y/N): y
Enter an integer and I will convert it to binary code: 123
You entered 123.
123 in binary is 1111011.
Do you want to continue(Y/N): y
Enter an integer and I will convert it to binary code: 359
You entered 359.
359 in binary is 101100111.
Do you want to continue(Y/N): y
Enter an integer and I will convert it to binary code: 1024
You entered 1024.
1024 in binary is 10000000000.
Do you want to continue(Y/N): n

Solution PreviewSolution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

1.
public class GridPrint {

public static void main(String[] args)
{
for(int i = 1; i <= 5; i++)
{
for(int j = i; j < i+5; j++)
System.out.print(j + " ");
System.out.println();
}
}
}...
$20.00 for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Java Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats