1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
scoundrel [369]
3 years ago
15

In Java; Given numRows and numColumns, print a list of all seats in a theater. Rows are numbered, columns lettered, as in 1A or

3E. Print a space after each seat, including after the last. Use separate print statements to print the row and column. Ex: numRows = 2 and numColumns = 3 prints:
1A 1B 1C 2A 2B 2C
import java.util.Scanner;
public class NestedLoops {
public static void main (String [] args) {
Scanner scnr = new Scanner(System.in);
int numRows;
int numColumns;
int currentRow;
int currentColumn;
char currentColumnLetter;

numRows = scnr.nextInt();
numColumns = scnr.nextInt();

numColumns = currentColumnLetter
for(currentRow = 0; currentRow < numRows;currentRow++){
for(currentColumn = =

System.out.println("");
}
}
Computers and Technology
1 answer:
Free_Kalibri [48]3 years ago
4 0

Answer:

import java.util.Scanner;

public class NestedLoops

{

public static void main(String[] args) {

 Scanner scnr = new Scanner(System.in);

       int numRows;

       int numColumns;

       int currentRow;

       int currentColumn;

       char currentColumnLetter;

       

       System.out.print("Enter number of rows: ");

       numRows = scnr.nextInt();

       System.out.print("Enter number of columns: ");

       numColumns = scnr.nextInt();

       

       for(int i = 1; i <= numRows; i++){

           currentColumn = 1;

           currentColumnLetter = 'A';

           for(int j = 1; j <= numColumns; j++){

               System.out.print("" + i + currentColumnLetter + " ");

               currentColumn++;

               currentColumnLetter++;

           }

       }

}

}

Explanation:

Ask user to enter the number of <em>rows</em> and <em>columns</em>.

Create a nested for loop, outer loop goes until <em>numRows</em> and inner loop goes until <em>numRows</em>.

Inside the first loop, set <em>currentColumn</em> to 1 and <em>currentColumnLetter</em> to 'A'. This way for after each row column value starts from 1 and letter value starts from A.

Insite the second loop, print the row value - <em>i</em>, and <em>currentColumnLetter</em>. Also,increment <em>currentColumn</em> and <em>currentColumnLetter</em> values by 1.

You might be interested in
Write a function which the counts the number of odd numbers and even numbers currently in the stack and prints the results.
Lerok [7]

Answer:

See the code below and the algorithm explanation on the figure.

Explanation:

The explanation in order to get the answer is given on the figure below.

Solving this problem with C. The program is given below:

#include <stdio.h>

int main(void) {

   int n, Even=0, Odd=0, Zeros=0;  

   for (;;) {

       printf("\nEnter the value the value that you want to check(remember just integers): ");

       //IF we input a non-numeric character the code end;

       if (scanf("%d", &n) != 1) break;

       if (n == 0) {

           Zeros++;

       }

       else {

           if (n % 2) {

               Even++;

           }

           else {

               Odd++;

           }

       }

   }  

   printf("for this case we have %d even, %d odd, and %d zero values.", Even, Odd, Zeros);

   return 0;

}

5 0
3 years ago
Complete the sentence.<br><br> A ___________search can be done on a list that is not ordered.
adelina 88 [10]

Answer:

Well, a binary search has to be ordered. So ima just say linear search..

Explanation:

I think its linear..

3 0
3 years ago
Read 2 more answers
Why doesnt brainly let me skip by watching video?
oksian1 [2.3K]

What do you want to skip in brainly? There isn't anything to skip that I can think of.

4 0
3 years ago
If several programs or apps are running simultaneously, your computer or device might use up its
kirill [66]

Answer: I am pretty sure it's RAM

Explanation:

I'm not 100% positive bc I haven't gotten my scores back yet but I think that's it.

7 0
2 years ago
Nnbnnb dfhhfhfbhfbhdffd<br> ddbhfbhdhfbhdhf<br> hhffudjbfbjkd<br> dbhdfbhbfhdb
saveliy_v [14]
Tahheuend
Thatgeheh
Thahyateg
Fascinating
:)
6 0
2 years ago
Other questions:
  • When parking ur vehicle facing downhill with a curb, you should point ur front wheels?
    7·2 answers
  • What precaution can you take while using a social networking site to prevent a data breach?
    15·1 answer
  • What is ucspi-tcp pakage in qmail??
    5·1 answer
  • Instructions
    12·1 answer
  • Windows, Apple’s Mac OS, and Unix/Linux are just some of the most common what?
    7·2 answers
  • Your friend is overspending and in need of a budget. What type of expense should they reduce next month?
    10·2 answers
  • Please help me and solution in c language​
    5·1 answer
  • How many total bits are required for a direct-mapped cache with 128 blocks and a block size of 8 bytes, assuming a 4GB main memo
    15·1 answer
  • How to square a number in java.
    15·1 answer
  • A laptop computer manufacturer would consider the computer's processor chip to be a(n) ______ cost.
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!