Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3439350
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T08:17:57+00:00 2026-05-18T08:17:57+00:00

I have to create a program that displays the 9 rows of a sudoku

  • 0

I have to create a program that displays the 9 rows of a sudoku as 9 9-digit numbers and then prompt the user to do one of 6 operations on the sudoku. Then we have to output the sudoku each time the user performs an operation. This is sort of a sample run of how it should go:

Welcome to Sudoku Permuter.

   C C C C C C C C C
   1 2 3 4 5 6 7 8 9
R1 0 8 0 4 0 2 0 6 0
R2 0 3 4 0 0 0 9 1 0
R3 9 6 0 0 0 0 0 8 4
R4 0 0 0 2 1 6 0 0 0
R5 2 0 0 0 0 9 6 0 0
R6 0 1 0 3 5 7 0 0 8
R7 8 4 0 0 0 0 0 7 5
R8 0 2 6 0 0 0 1 3 0
R9 0 9 0 7 0 1 0 4 0

(0 denotes a blank)

Enter 1 to swap two rows in a panel
Enter 2 to swap two columns in a panel
Enter 3 to swap two row panels
Enter 4 to swap two column panels
Enter 5 to swap two numbers
Enter 0 to end:

Let’s say the user enters 3 (to swap two row panels). This would come up:

Enter row panels (1-3) to swap: 3 1

It would swap row panels 1 and 3, and this would be the output:

   C C C C C C C C C
   1 2 3 4 5 6 7 8 9
R1 8 4 0 0 0 0 0 7 5
R2 0 2 6 0 0 0 1 3 0
R3 0 9 0 7 0 1 0 4 0
R4 0 0 0 2 1 6 0 0 0
R5 2 0 0 0 0 9 6 0 0
R6 0 1 0 3 5 7 0 0 8
R7 0 8 0 4 0 2 0 6 0
R8 0 3 4 0 0 0 9 1 0
R9 9 6 0 0 0 0 0 8 4

Rows 1-3 have been switched with rows 7-9.

Let’s say the user inputs 5. This comes up:

Enter two numbers: 2 8

The original sudoku is outputted again, except 2’s and 8’s are switched throughout.

   C C C C C C C C C
   1 2 3 4 5 6 7 8 9
R1 0 2 0 4 0 8 0 6 0
R2 0 3 4 0 0 0 9 1 0
R3 9 6 0 0 0 0 0 2 4
R4 0 0 0 8 1 6 0 0 0
R5 8 0 0 0 0 9 6 0 0
R6 0 1 0 3 5 7 0 0 2
R7 2 4 0 0 0 0 0 7 5
R8 0 8 6 0 0 0 1 3 0
R9 0 9 0 7 0 1 0 4 0

If the user entered 1, something would come up saying

Enter two rows (1-9) to switch:

And whichever rows the user enters, those two individual rows would be swapped and the sudoku would once again be outputted. It’d be similar if the user entered 2, except 2 columns would be switched. Similarly, if the user entered 4, two column panels would be switched.

We’re supposed to use a two dimensional array like this:

int [] [] sudoku = new int[10] [10]

I have no idea how to do this. I’ve been struggling all semester, this is my first programming class. I just don’t understand arrays at all, and I don’t understand how we’re even supposed to display the sudoku in the first place. This problem isn’t in our book, so I have nothing to look back on, either. I really need to pass this class. If anyone could help me, I really appreciate it. Try to make it easy to understand, there’s a lot of stuff I haven’t learned how to do yet (ex: for the record, idk what parseInt is). I’ve tried reading the book (several times). It helps some, but this program is going to be impossible. Thank you SO much for the help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T08:17:58+00:00Added an answer on May 18, 2026 at 8:17 am
    1. Do you know how to read input?
    2. Do you know how to work with 1-dimensional arrays (lists), like {1, 2, 3, 4, 5}?
    3. Do you understand for loops?
    4. What part of the concept of arrays seems difficult to you?

    For instance, here’s a block of code that just prints out the raw contents of the array. Does this code make sense?

    int [] [] sudoku = new int[10] [10];
    // loop through all of the rows
    for (int row = 0; row < 10; row++) {
        // loop through all columns for each row
        for (int column = 0; column < 10; column++) {
            // print out the sudoku value at that row and column
            System.out.print(sudoku[row] [column] + " ");
        }
        // at the end of the row, print a blank line to start the next row
        System.out.println();
    }
    

    Here’s how you can hard-code your sample board to work with it:

    int [] [] sudoku = new int [] [] {
        { 0, 8, 0, 4, 0, 2, 0, 6, 0 },
        { 0, 3, 4, 0, 0, 0, 9, 1, 0 },
        etc.
    }
    

    Here’s some pseudo-code for swapping two rows.

    Get first row # from user
    Get second row # from user
    Loop through each column in the board
        Swap(cell at first row #, current column, cell at second row #, current column)
    End Loop
    

    Swapping basically requires a temporary variable to hold one of the values while swapping:

    Swap(a, b)
        Store a into Temp
        Store b into a
        Store Temp into b
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a JSP program that displays a form where the user enters some
I have to create a cipher program that shifts the letters of a message
For a school assignment I have to create a C++ program that will create
I have a small program that I'm trying to create to get ip addresses
I have a simple program that creates a thread, loops twenty times and then
I'm needing to write a program (C#) that will allow the user to create
Hi I have a small problem. I am coding a program that displays the
I have a program that displays an animation with a fixed frame rate (say
I have implemented a simple GPS program that fetches the co-ordinates and displays them
I have created a non-form c# program that uses the NotifyIcon class. The text

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.